Python Urllib2.httperror Http Error 503 Service Unavailable
Contents |
here for a quick overview of the site Help Center Detailed answers to any urllib2.httperror: http error 503: service unavailable goslate questions you might have Meta Discuss the workings and policies of
Urllib.error.httperror: Http Error 503: Service Unavailable Google
this site About Us Learn more about Stack Overflow the company Business Learn more about hiring textblob translate developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is goslate 503 a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Python urllib2.HTTPError: HTTP Error 503: Service Unavailable on valid website up vote 4 down vote favorite 2 I have been using Amazon's Product Advertising API to generate urls that contains prices
Python Translate Language
for a given book. One url that I have generated is the following: http://www.amazon.com/gp/offer-listing/0415376327%3FSubscriptionId%3DAKIAJZY2VTI5JQ66K7QQ%26tag%3Damaztest04-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0415376327 When I click on the link or paste the link on the address bar, the web page loads fine. However, when I execute the following code I get an error: url = "http://rads.stackoverflow.com/amzn/click/0415376327" html_contents = urllib2.urlopen(url) The error is urllib2.HTTPError: HTTP Error 503: Service Unavailable. First of all, I don't understand why I even get this error since the web page successfully loads. Also, another weird behavior that I have noticed is that the following code sometimes does and sometimes does not give the stated error: html_contents = urllib2.urlopen("http://rads.stackoverflow.com/amzn/click/0415376327") I am totally lost on how this behavior occurs. Is there any fix or work around to this? My goal is to read the html contents of the url. EDIT I don't know why stack overflow is changing my code to change the amazon link I listed above in my code to rads.sta
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn python urllib user agent more about Stack Overflow the company Business Learn more about hiring developers or posting google search python ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community
Python Requests User Agent
Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up urllib2.HTTPError: HTTP Error 503: Service Unavailable up vote 0 down http://stackoverflow.com/questions/25936072/python-urllib2-httperror-http-error-503-service-unavailable-on-valid-website vote favorite I am getting the following exception: file "/usr/lib64/python2.6/urllib2.py", line 518, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 503: Service Unavailable My code: opener = urllib2.build_opener() opener.addheaders = [('User-agent', 'Mozilla/5.0')] response = opener.open(filePath) logText = response.read(); Moreover, I tried the following code as well: response = urllib2.urlopen(filePath) logText = response.read(); I am still getting the said error. However, I can access the filePath i.e. http://stackoverflow.com/questions/35512132/urllib2-httperror-http-error-503-service-unavailable the url from windows machine using any browser. But I cannot access the same filePath i.e. the URL from the linux machine where I am executing my Python script. Moreover, from this linux machine I cannot even open a web browser. EDIT: URL looks like this: http://tweb.mk.ca.am.polik.se/executions/6061/60583/logs/screenlog.ob1110.191120.txt However, as I am able to access this URL from the windows machine that's why I don't think that there is any problem at the server. Thanks!! python linux urllib2 share|improve this question edited Feb 19 at 18:25 asked Feb 19 at 18:17 John Rambo 6617 503 is generated server-side, so it's likely caused by something in the URL you're using and you didn't provide that. –Todd Knarr Feb 19 at 18:22 "...from this linux machine I cannot even open a web browser" -- I suggest you try a site that's more tech-support related, such as superuser –leongold Feb 19 at 18:24 @ToddKnarr edited the question –John Rambo Feb 19 at 18:30 I can't even get the host to resolve. It could be a Web filter that's set to deny the Linux machines Web access on the theory they don't need it, or something else entirely. Normally I
Sign in Pricing Blog Support Search GitHub This repository https://github.com/mnielsen/mini_qa/issues/2 Watch 5 Star 29 Fork 19 mnielsen/mini_qa Code Issues 0 Pull requests 0 Projects 0 Pulse Graphs New issue urllib2 uncatched exception when request is not answered #2 Closed newlog opened this Issue Sep 19, 2012 · 2 comments Projects None yet Labels None http error yet Milestone No milestone Assignees No one assigned 2 participants newlog commented Sep 19, 2012 The problem is in the google.py file, line 96 (the line might change given some modifications I've done to the code). The exception goes like this: Traceback (most recent http error 503 call last): File "mini_qa.py", line 325, in pretty_qa("Who is the world's best tennis player?") File "mini_qa.py", line 78, in pretty_qa for (j, (answer, score)) in enumerate(qa(question, source)[:num]): File "mini_qa.py", line 96, in qa gqa = google_qa(question) File "mini_qa.py", line 111, in google_qa for summary in get_summaries(query.query): File "mini_qa.py", line 187, in get_summaries results = search(query) File "/Users/newlog/Documents/Proyectos/misc/github/mini_qa/google.py", line 181, in search html = get_page(url) File "/Users/newlog/Documents/Proyectos/misc/github/mini_qa/google.py", line 95, in get_page response = urllib2.urlopen(request) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open response = meth(req, response) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response 'http', request, response, code, msg, hdrs) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 432, in error result = self._call_chain(args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain result = func(args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 619, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "/System/Library/Frame