Skip to content

Instantly share code, notes, and snippets.

@cdfox
Created April 30, 2012 18:39
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 cdfox/2560930 to your computer and use it in GitHub Desktop.
Save cdfox/2560930 to your computer and use it in GitHub Desktop.
Using the Requests library
import requests
import codecs
url = 'http://www.instapaper.com/m'
params = {'u': 'http://techcrunch.com/2012/04/30/bn-8-k-microsoft-paying-180m-advance-on-nook-for-windows-8-125m-for-content-tech-acquisition/'}
r = requests.get(url, params=params)
# r.text holds the response from the server. It appears to be unicode in this case.
f = codecs.open("foo.html", mode="w", encoding="UTF-8")
f.write(r.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment