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

Discussion in 'Python' started by Josef Cihal, Sep 5, 2005.

  1. Josef Cihal

    Josef Cihal Guest

    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')>
     
    Josef Cihal, Sep 5, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    473
    John J. Lee
    Sep 24, 2003
  2. Replies:
    3
    Views:
    358
    John J. Lee
    Jul 11, 2007
  3. gervaz
    Replies:
    0
    Views:
    781
    gervaz
    Dec 16, 2009
  4. Daniel Pereira

    HTTPCookieProcessor in ruby

    Daniel Pereira, Oct 15, 2009, in forum: Ruby
    Replies:
    0
    Views:
    139
    Daniel Pereira
    Oct 15, 2009
  5. KMeans Algorithm
    Replies:
    4
    Views:
    87
    Terry Reedy
    Jan 12, 2014
Loading...

Share This Page