跳到正文

在BAE环境中如何引入requests库

网友提供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文件

回复

likai

3.0允许了,

ooh

bae允许写?

allenforrest

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

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

↑