python urllib2: connection reset by peer
问题 I have a perl program that retrieves data from the database of my university library and it works well. Now I want to rewrite it in python but encounter the problem <urlopen error [errno 104] connection reset by peer> The perl code is: my $ua = LWP::UserAgent->new; $ua->cookie_jar( HTTP::Cookies->new() ); $ua->timeout(30); $ua->env_proxy; my $response = $ua->get($url); The python code I wrote is: cj = CookieJar(); request = urllib2.Request(url); # url: target web page opener = urllib2.build