Skip to content

Instantly share code, notes, and snippets.

@minderx
Last active April 11, 2020 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minderx/d7050ac5ca0ad8e7f4cb1ab497838fac to your computer and use it in GitHub Desktop.
Save minderx/d7050ac5ca0ad8e7f4cb1ab497838fac to your computer and use it in GitHub Desktop.
# -*- 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