download webpage api hangs
download webpage api hangs
(OP)
I am trying to download a web page from a local program accessed thru an api. It works thru a browser and it works in python but it appears to hang and just sits there like the request never closes. It actually prints the contents to shell.
Any ideas?
Simi
import urllib.request
link="""http://172.17.3.18:7780/dataservices/cdk?SP=md_cst...('mj0001','1','5000','1','',?,?,?int status)"""
print(link)
x = urllib.request.urlopen(link)
print(x.read())
Any ideas?
Simi
import urllib.request
link="""http://172.17.3.18:7780/dataservices/cdk?SP=md_cst...('mj0001','1','5000','1','',?,?,?int status)"""
print(link)
x = urllib.request.urlopen(link)
print(x.read())
RE: download webpage api hangs
Simi
RE: download webpage api hangs
response = urllib.request.urlopen(link, timeout=.5).read().decode('utf-8')
It still takes 5 seconds to retrieve 3000 rows.
Thanks
Simi
RE: download webpage api hangs
Chris.
Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
RE: download webpage api hangs
Any ideas?
Thanks Simi
CODE --> phython
RE: download webpage api hangs
Chris.
Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
RE: download webpage api hangs
Here is the latest error messages.
Traceback (most recent call last):
File "C:\Program Files\python33\url_test.py", line 32, in <module>
resp=urllib.request.urlopen(req)
File "C:\Program Files\python33\lib\urllib\request.py", line 160, in urlopen
return opener.open(url, data, timeout)
File "C:\Program Files\python33\lib\urllib\request.py", line 479, in open
response = meth(req, response)
File "C:\Program Files\python33\lib\urllib\request.py", line 591, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Program Files\python33\lib\urllib\request.py", line 517, in error
return self._call_chain(*args)
File "C:\Program Files\python33\lib\urllib\request.py", line 451, in _call_chain
result = func(*args)
File "C:\Program Files\python33\lib\urllib\request.py", line 599, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request
Thanks
Simi