Created
July 12, 2012 17:06
-
-
Save thanos/3099353 to your computer and use it in GitHub Desktop.
A quick version of urlopen but nearly always works
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
| import httplib2 | |
| def url_fetch(url, user=None, password=None, method="GET", body=None, headers=None, redirections=httplib2.DEFAULT_MAX_REDIRECTS, connection_type=None): | |
| """ | |
| A quick version of urlopen but nealry always works | |
| """ | |
| h = httplib2.Http(".cache") | |
| if user: | |
| h.add_credentials(user,password) | |
| return h.request(url, method=method, body=body, headers=headers, redirections=redirections, connection_type=connection_type) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment