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

  • Thread starter ³É¶¼ÆßÖÐ2002¼¶7°à_´ó¼Ò¶¼ÊÇÌì²Å¡«
  • Start date
³

³É¶¼ÆßÖÐ2002¼¶7°à_´ó¼Ò¶¼ÊÇÌì²Å¡«

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?
 
C

Chris Angelico

2011/7/5 ³É¶¼ÆßÖÐ2002¼¶7°à_´ó¼Ò¶¼ÊÇÌì²Å¡« said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top