URLError: <urlopen error [Errno 104] Connection reset by peer>
Whenever I make a call to facebook server to fetch user data using FQL, 10% of the time I get
URLError: <urlopen error [Errno 104] Connection reset by peer>
I am not able to reproduce this error. Below is the traceback:
File "/home/fb.py", line 250, in get_data()
return json.load(urlopen(URL, params))
File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.6/urllib2.py", line 391, in open
开发者_JAVA技巧 response = self._open(req, data)
File "/usr/lib/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 1169, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib/python2.6/urllib2.py", line 1136, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 104] Connection reset by peer>
Any help appreciated
This error is usually created by mismanaged or badly setup firewalls or proxy systems, if you try running your program from a household adsl line or on a simple connection there should be no problem with your code, 104 is the error code thrown back when something inside your local area network has a hissy fit and gives up crying.
Try cache=None
as client param. It helped me to solve same issue.
client = suds.client.Client(url, cache=None)
精彩评论