Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8780 > unrolled thread

i have configured proxy but fiddler can't capture python's network requests

Started by成都七中2002级7班_大家都是天才~ <liu.liuwei.wei@gmail.com>
First post2011-07-04 10:33 -0700
Last post2011-07-05 03:50 +1000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  i have configured proxy but fiddler can't capture python's network requests 成都七中2002级7班_大家都是天才~ <liu.liuwei.wei@gmail.com> - 2011-07-04 10:33 -0700
    Re: i have configured proxy but fiddler can't capture python's network requests Chris Angelico <rosuav@gmail.com> - 2011-07-05 03:50 +1000

#8780 — i have configured proxy but fiddler can't capture python's network requests

From成都七中2002级7班_大家都是天才~ <liu.liuwei.wei@gmail.com>
Date2011-07-04 10:33 -0700
Subjecti have configured proxy but fiddler can't capture python's network requests
Message-ID<163b004e-5e86-4fe1-912c-1305ce2b753c@35g2000prp.googlegroups.com>
here's my code. I've change the port from 8888 to 1111.

import urllib2
proxy_support = urllib2.ProxyHandler({'http':'http://127.0.0.1:1111'})
opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler)
urllib2.install_opener(opener)
content = urllib2.urlopen('http://www.google.com').read()
print content

The weird thing is:
1. If I close fiddler, python throws error when running

Traceback (most recent call last):
  File "C:\Users\Micky\test.py", line 5, in <module>
    content = urllib2.urlopen('http://www.google.com').read()
  File "D:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "D:\Python27\lib\urllib2.py", line 394, in open
    response = self._open(req, data)
  File "D:\Python27\lib\urllib2.py", line 412, in _open
    '_open', req)
  File "D:\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "D:\Python27\lib\urllib2.py", line 1199, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "D:\Python27\lib\urllib2.py", line 1174, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 10061] No connection could be made
because the target machine actively refused it>

2. If I open fiddler, everything works great. But I can't see the
traffic in fiddler. And if I change port from 1111 to any other
number, it works find too.

Any clues?

[toc] | [next] | [standalone]


#8783

FromChris Angelico <rosuav@gmail.com>
Date2011-07-05 03:50 +1000
Message-ID<mailman.602.1309801830.1164.python-list@python.org>
In reply to#8780
2011/7/5 成都七中2002级7班_大家都是天才~ <liu.liuwei.wei@gmail.com>:
> 2. If I open fiddler, everything works great. But I can't see the
> traffic in fiddler. And if I change port from 1111 to any other
> number, it works find too.
>

It sounds to me like the traffic's going through fiddler, but you're
just not seeing any log entries. The reactions from the Python end are
exactly what I'd expect. Look at fiddler's documentation to see if you
can enable verbose logging, or something of the sort.

Chris Angelico

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web