Python urlopen connection aborted - urlopen error [Errno 10053]

I have code that uses mechanize and beautifulsoup to web search for some data. The code works fine on a test machine, but the production machine blocks the connection. The error I get is:

urlopen error [Errno 10053] An established connection was aborted by the software in your host machine 

I read similar posts and I cannot find this exact error. The site I'm trying to clean up is HTTPS, but I also had the same error with the HTTP site. I am using python 2.6 and mechanize 0.2.4.

Is it because of the proxy or, as the error says, is something on my local machine? I wrote to use the system proxy for mechanization:

 br = mechanize.Browser() br.addheaders = [('User-agent', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1')] br.set_proxies({}) #will use system default proxy page = br.open(url) html = page.read() soup = BeautifulSoup.BeautifulSoup(html) 

Again, all this works on my test machine, but the production machine gives error 10053.

+6
python proxy web-scraping errno mechanize
source share
1 answer

The problem here was that the host-based IDS prevented the connection. The problem is resolved.

I have added a python script to the HIDS exception list. Exclusion list - a list of files that I allowed to connect to the Internet. When it was added to the list, I was able to connect to the network using a script and there were no more problems. The HIDS client was not installed on the test machine, so it allowed me to talk. FYI, both had firewalls, but only one (production machine) had HIDS.

HIDS is a host-based intrusion detection system. If the network security team has made HIDS invisible to you, you may not know where to find it. In addition, even if you find it, you cannot turn it off. You can ask your security team if they can add an exception to your script. Another insightful way around HIDS is to create your exe script (using Py2EXE) and rename the executable you create to something already existing in the HIDS exception list. Renaming it is good for your browser, so if Firefox is allowed to access the Internet, rename exe to firefox.exe.

+2
source share

All Articles