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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Josef Cihal

    #1

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

    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.Mozil laCookieJar()
    os.environ["http_proxy "] = "http://proxy.irm.at:12 34"
    os.environ['HOME']= r"C:\tmp\COOKIE "
    #
    cj.load(os.path .join(os.enviro n["HOME"], "cookies.tx t"))
    opener = urllib2.build_o pener(urllib2.H TTPCookieProces sor(cj))
    r = opener.open("ht tp://brokerjet.ecetr a.com/at/news/?/")

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "C:\Programme\P ython24\lib\url lib2.py", line 358, in open
    response = self._open(req, data)
    File "C:\Programme\P ython24\lib\url lib2.py", line 376, in _open
    '_open', req)
    File "C:\Programme\P ython24\lib\url lib2.py", line 337, in _call_chain
    result = func(*args)
    File "C:\Programme\P ython24\lib\url lib2.py", line 1021, in http_open
    return self.do_open(ht tplib.HTTPConne ction, req)
    File "C:\Programme\P ython24\lib\url lib2.py", line 996, in do_open
    raise URLError(err)
    urllib2.URLErro r: <urlopen error (10061, 'Connection refused')>
Working...