Skip to content

Instantly share code, notes, and snippets.

@ojacquemart
Created February 28, 2013 20:54
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 ojacquemart/5060041 to your computer and use it in GitHub Desktop.
Save ojacquemart/5060041 to your computer and use it in GitHub Desktop.
Get webpage content in python.
import urllib2
response = urllib2.urlopen('http://github.com')
html = response.read()
print html
@ojacquemart
Copy link
Author

Update to urllib3

import urllib3

http = urllib3.PoolManager()

r = http.request('GET', 'http://google.com/')

print r.status, r.data

https://pypi.python.org/pypi/urllib3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment