Can't Access ANY url from python (errno 61)
clp2 at rebertia.com
Fri Feb 19 23:12:21 CET 2010
On Fri, Feb 19, 2010 at 1:48 PM, MattB <mattbarkan at gmail.com> wrote:
> Hey all,
> I've been working on a program that accesses my school's password
> protected website and downloads directory names. I'm using mechanize.
> Recently, the program has been unable to open the website, returning
> the 'errno 61 connection refused' error. I presume the school's server
> was blocking me because of many automated logins.
> However, it turns out that I cannot now open ANY url from within
> Python on my computer using mechanize (or urllib for that matter).
> And I've tried in several places -- my place, a friend's place (who
> also has comcast as an ISP) and the school -- but no dice, constant
> errno 61's whenever I try to open a url.
> The strangest thing about this is that firefox still works flawlessly
> on any site.
> Can anyone think of anything I can do to solve this problem? Why would
> firefox be working fine but not Python?
> Any suggestions would be greatly appreciated.
Based on what you've said, it's possible the school may have blocked
mechanize's User-Agent somehow.
Try spoofing mechanize as Firefox by setting the string for the
User-Agent header to that of Firefox.
See the section "Changing the automatically-added headers
(User-Agent)" on http://wwwsearch.sourceforge.net/mechanize/doc.html
for how to do that.
To see what Firefox's User-Agent is, use http://whatsmyuseragent.com/
Disclaimer: This is not meant to in any way endorse violating AUPs.
More information about the Python-list