Problem with: urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

J

Josef Cihal

Hi,

I get an error, when I am trying to download URL with using Cookies.
Where is the Problem?

Thank u very much for all ideas!!!

sincerely

Josef


import os, cookielib, urllib2
cj = cookielib.MozillaCookieJar()
os.environ["http_proxy"] = "http://proxy.irm.at:1234"
os.environ['HOME']= r"C:\tmp\COOKIE"
#
cj.load(os.path.join(os.environ["HOME"], "cookies.txt"))
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
r = opener.open("http://brokerjet.ecetra.com/at/news/?/")

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\Programme\Python24\lib\urllib2.py", line 358, in open
response = self._open(req, data)
File "C:\Programme\Python24\lib\urllib2.py", line 376, in _open
'_open', req)
File "C:\Programme\Python24\lib\urllib2.py", line 337, in _call_chain
result = func(*args)
File "C:\Programme\Python24\lib\urllib2.py", line 1021, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Programme\Python24\lib\urllib2.py", line 996, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (10061, 'Connection refused')>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top