1

I am writing a code to scrape data from a website. The code was working fine until I decided to hide my IP address. I get the following error "urlopen error [WinError 10061] No connection could be made because the target machine actively refused it"

I have disabled the firewalls and antivirus on my machine; Tor is installed and running, internet connection is fine (obviously). Could someone help me figure out where the problem is? And whether it can be fixed (I cannot change the website I am scraping data from.)?

Here is the code:

list_url= ["http://www.url.com"]
proxy_support = urllib.request.ProxyHandler({"http":"http://127.0.0.1:8118"})  
opener = urllib.request.build_opener(proxy_support)  
urllib.request.install_opener(opener)

for url in list_url:
 base_url_parts = urllib.parse.urlparse(url)
 while True:
    raw_html = urllib.request.build_opener(proxy_support).open(url).read()
...
anne_t
  • 435
  • 1
  • 7
  • 16
  • Probably because the website you are visiting has methods to prevent you from using TOR or proxies. Google will make you type in captchas if you are using a proxy or TOR. – jkd Mar 26 '15 at 04:38
  • Thanks @jakekimds. So are there any ways around that problem? Just in case it changes your answer, I can access the website from the TOR browser. (Can you tell I'm clueless about these things? ;-) ) – anne_t Mar 26 '15 at 12:08

0 Answers0