我正在尝试这段代码
@app.route('/process/<user_id>/<file_format>/<download>', methods=['POST', 'GET'])
def download(user_id, file_format, download):
if request.method == 'GET':
response = urllib2.urlopen("http://"+socket.gethostname()+"app/documents/"+ download)
html = response.read()
return html
但我得到:
URLError: <urlopen error [Errno -2] Name or service not known>
如果我只做 response = urllib2.urlopen("app/documents/"+ download)
我得到:
ValueError: unknown url type: app/documents/thereport_1712818a-39a3-436e-985c-84f1e8d43346.pdf
那么,基本上我怎样才能从我的文件夹中获取文件?