Last active
April 11, 2020 23:28
-
-
Save minderx/d7050ac5ca0ad8e7f4cb1ab497838fac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Nov 4 20:25:11 2012 | |
""" | |
import urllib2 | |
import json | |
with open('article.txt', 'r') as f: | |
# Get text from file | |
text_file = f.read() | |
# Important don't remove , always replace '%0A' with '%0D%0A' <- CR, EOL | |
encoded_text = urllib2.quote(text_file).replace('%0A', '%0D%0A') | |
# Api Call | |
api_call = 'https://autosummarizer.com/api/v1/?break=1&text='+encoded_text | |
# Get summary | |
summary = json.loads(urllib2.urlopen(api_call).read())['summary'] | |
# Print Summary | |
print summary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment