小编Lis*_*fin的帖子

urllib.request.urlopen 500错误

以下代码:

   req = urllib.request.Request(url=r"http://borel.slu.edu/cgi-bin/cc.cgi?foirm_ionchur=im&foirm=Seol&hits=1&format=xml",headers={'User-Agent':' Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0'})
   handler = urllib.request.urlopen(req)
Run Code Online (Sandbox Code Playgroud)

给我以下例外:

Traceback (most recent call last):
  File "C:/Users/Foo/lang/old/test.py", line 46, in <module>
    rip()
  File "C:/Users/Foo/lang/old/test.py", line 36, in rip
    handler = urllib.request.urlopen(req)
  File "C:\Python32\lib\urllib\request.py", line 138, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python32\lib\urllib\request.py", line 375, in open
    response = meth(req, response)
  File "C:\Python32\lib\urllib\request.py", line 487, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python32\lib\urllib\request.py", line 413, in error
    return self._call_chain(*args)
  File "C:\Python32\lib\urllib\request.py", line …
Run Code Online (Sandbox Code Playgroud)

python python-3.x

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×1

python-3.x ×1