我想上传并从此网站获取结果。 http://cello.life.nctu.edu.tw/
我试过
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
register_openers()
params = ({"file": open("xaa", "r"),
"seqtype": "prot",
"species": "eu"})
datagen, headers = multipart_encode(params)
request = urllib2.Request("http://cello.life.nctu.edu.tw/cgi/main.cgi", datagen, headers)
print urllib2.urlopen(request).read()
但我收到了错误
Traceback (most recent call last):
File "client.py", line 9, in <module>
a = opener.open("http://cello.life.nctu.edu.tw/cgi/main.cgi", params)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 400, in open
response = meth(req, response)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 513, in http_response
'http', request, response, code, msg, hdrs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 438, in error
return self._call_chain(*args)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 521, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error
我不知道这里有什么问题。有人能指出我吗? ?谢谢。
顺便说一句。 xaa文件看起来像http://pastebin.com/7VK3vvwC
答案 0 :(得分:1)
Error 500: Internal Server Error
这是服务器错误。换句话说,你的代码没有任何问题 - 只是这个页面出错了。