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

Josef Cihal josef.cihal at irm.at
Mon Sep 5 07:26:32 EDT 2005


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')>



More information about the Python-list mailing list