Reputation: 4170
I'm trying the following -
import urllib2
page = urllib2.urlopen('http://dviappvmtca01:9001/deploy/?jobname=\blah12345')
print page.getcode()
I can open that site in my browser and with httpfox and I get/see a 404. If I try from python with the script above I get the following dump -
Traceback (most recent call last):
File "C:\test.py", line 3, in <module>
page = urllib2.urlopen('http://dviappvmtca01:9001/deploy/?jobname=\blah12345')
File "C:\Python27\lib\urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 410, in open
response = meth(req, response)
File "C:\Python27\lib\urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Python27\lib\urllib2.py", line 448, in error
return self._call_chain(*args)
File "C:\Python27\lib\urllib2.py", line 382, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 500: INTERNAL SERVER ERROR
Upvotes: 0
Views: 2201
Reputation: 168766
urllib2.urlopen
returns a 500 because, to quote the standard, "The server encountered an unexpected condition which prevented it from fulfilling the request."
The log files of the server might provide information about why the server returned 500.
Upvotes: 2