在BAE环境中如何引入requests库

vps网友提供 12-21 讨论归档 3
我在BAE的项目目录中requirements.txt添加了requests
然后部署这个程序

#coding=utf-8

f=open(r'/home/bae/log/log.txt','a+')
try:
import requests
r = requests.get('http://www.baidu.com')
test=r.text

f.writelines(test.encode('utf-8'))
except:
pass
finally:
f.writelines('error')
f.close()

好像没有生成log.txt文件

本文由 vps网友提供,转载请注明出处

本文链接: https://www.vpsvsvps.com/discuss/a/1676471641414045696.html

标签:
likai
12-21

3.0允许了,

ooh
12-21

bae允许写?

allenforrest
12-21

去requests官网下载下来,直接放在BAE里你自己APP目录里。

requests全python写成,无native动态库依赖,很方便。