Answer the question
In order to leave comments, you need to log in
Why is the proxy not working on the server?
Hello.
Why might not using a proxy on the server work?
I do the same on the PC and on the server. On the PC it gives - 200 code, on the server - 503. What's wrong?
I actually do this on PC:
>>> import urllib2
>>> proxy = urllib2.ProxyHandler({'https': '63.141.245.50:2022'})
>>> opener = urllib2.build_opener(proxy)
>>> urllib2.install_opener(opener)
>>> a = urllib2.urlopen('http://www.yelp.com')
>>> print a.code
200
>>> import urllib2
>>> proxy = urllib2.ProxyHandler({'https': '63.141.245.50:2022'})
>>> opener = urllib2.build_opener(proxy)
>>> urllib2.install_opener(opener)
>>> a = urllib2.urlopen('http://www.yelp.com')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 407, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 445, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 503: Service Temporarily Unavailable
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question