Created
April 30, 2012 18:39
-
-
Save cdfox/2560930 to your computer and use it in GitHub Desktop.
Using the Requests library
This file contains 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
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