[New-bugs-announce] [issue15928] Open url with proxy causes TypeError

zhang kai report at bugs.python.org
Wed Sep 12 07:45:02 CEST 2012

New submission from zhang kai:

Here is the code which causes this bug:
 proxy_handler = urllib2.ProxyHandler({'https': proxy})
 opener = urllib2.build_opener(proxy_handler)
 f = opener.open(url+'?'+params)

Here are the traceback information:
Traceback (most recent call last):
  File "proxy.py", line 65, in <module>
  File "proxy.py", line 62, in main
    print proxy_manager.get_proxy()
  File "proxy.py", line 45, in get_proxy
    make_request(TEST_URL, proxy=one["proxy_server"])
  File "proxy.py", line 27, in make_request
    f = opener.open(url+'?'+params)
  File "/usr/lib/python2.7/urllib2.py", line 400, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 418, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1215, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1174, in do_open
    h.request(req.get_method(), req.get_selector(), req.data, headers)
  File "/usr/lib/python2.7/httplib.py", line 958, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 992, in _send_request
  File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
  File "/usr/lib/python2.7/httplib.py", line 814, in _send_output
  File "/usr/lib/python2.7/httplib.py", line 776, in send
  File "/usr/lib/python2.7/httplib.py", line 1160, in connect
  File "/usr/lib/python2.7/httplib.py", line 748, in _tunnel
    line = response.fp.readline(_MAXLINE + 1)
TypeError: readline() takes exactly 1 argument (2 given)

components: Library (Lib)
messages: 170354
nosy: zhang.kai
priority: normal
severity: normal
status: open
title: Open url with proxy causes TypeError
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list