Using an HTTP PROXY – Python [duplicate]

You can do it even without the HTTP_PROXY environment variable. Try this sample: import urllib2 proxy_support = urllib2.ProxyHandler({“http”:”http://61.233.25.166:80″}) opener = urllib2.build_opener(proxy_support) urllib2.install_opener(opener) html = urllib2.urlopen(“http://www.google.com”).read() print html In your case it really seems that the proxy server is refusing the connection. Something more to try: import urllib2 #proxy = “61.233.25.166:80” proxy = “YOUR_PROXY_GOES_HERE” proxies = … Read more

Only use a proxy for certain git urls/domains?

To add another possibility, you can define a proxy through the git config http.proxy. git config –global http.proxy http://mydomain\\myusername:mypassword@myproxyserver:proxyport But what is really neat is, starting git1.8.5 (October 2013), you can set http settings per url. The “http.*” variables can now be specified per URL that the configuration applies. For example, [http] sslVerify = true … Read more

How do I use Maven through a proxy?

For details of setting up a proxy for Maven, see the mini guide. Essentially you need to ensure the proxies section in either the global settings ([maven install]/conf/settings.xml), or user settings (${user.home}/.m2/settings.xml) is configured correctly. It is better to do this in your user settings to avoid storing the password in plain text in a … Read more

How to connect to Tor browser using Python

To connect to a Tor Browser through a FirefoxProfile you can use the following solution: Code Block: from selenium import webdriver from selenium.webdriver.firefox.firefox_profile import FirefoxProfile import os torexe = os.popen(r’C:\Users\AtechM_03\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe’) profile = FirefoxProfile(r’C:\Users\AtechM_03\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default’) profile.set_preference(‘network.proxy.type’, 1) profile.set_preference(‘network.proxy.socks’, ‘127.0.0.1’) profile.set_preference(‘network.proxy.socks_port’, 9050) profile.set_preference(“network.proxy.socks_remote_dns”, False) profile.update_preferences() driver = webdriver.Firefox(firefox_profile= profile, executable_path=r’C:\Utility\BrowserDrivers\geckodriver.exe’) driver.get(“http://check.torproject.org”) Browser Snapshot: You can find … Read more

How to create a simple proxy in C#?

I wouldn’t use HttpListener or something like that, in that way you’ll come across so many issues. Most importantly it’ll be a huge pain to support: Proxy Keep-Alives SSL won’t work (in a correct way, you’ll get popups) .NET libraries strictly follows RFCs which causes some requests to fail (even though IE, FF and any … Read more

Using pip behind a proxy with CNTLM

With Ubuntu I could not get the proxy option to work as advertised – so following command did not work: sudo pip –proxy http://web-proxy.mydomain.com install somepackage But exporting the https_proxy environment variable (note its https_proxy not http_proxy) did the trick: export https_proxy=http://web-proxy.mydomain.com then sudo -E pip install somepackage

How do I make HttpURLConnection use a proxy?

Since java 1.5 you can also pass a java.net.Proxy instance to the openConnection(proxy) method: //Proxy instance, proxy ip = 10.0.0.1 with port 8080 Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(“10.0.0.1”, 8080)); conn = new URL(urlString).openConnection(proxy); If your proxy requires authentication it will give you response 407. In this case you’ll need the following code: Authenticator … Read more