Skip to content

Instantly share code, notes, and snippets.

@maksymx
Created September 9, 2015 15:24
Show Gist options
  • Save maksymx/79880fe400fc316c11af to your computer and use it in GitHub Desktop.
Save maksymx/79880fe400fc316c11af to your computer and use it in GitHub Desktop.
Urllib2 opener via proxy
import urllib2
proxy_server = 'http://username:password@ip_address:port'
proxy_handler = urllib2.ProxyHandler({"http": proxy_server, "https": proxy_server})
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie_jar), proxy_handler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment