V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Recommended Services
Amazon Web Services
LeanCloud
New Relic
ClearDB
pc10201
V2EX  ›  云计算

在BAE环境中如何引入requests库

  •  
  •   pc10201 · 2013-12-21 19:31:00 +08:00 · 2835 次点击
    这是一个创建于 3778 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在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文件
    3 条回复    1970-01-01 08:00:00 +08:00
    allenforrest
        1
    allenforrest  
       2013-12-21 20:45:19 +08:00
    去requests官网下载下来,直接放在BAE里你自己APP目录里。

    requests全python写成,无native动态库依赖,很方便。
    ooh
        2
    ooh  
       2013-12-21 20:45:31 +08:00
    bae允许写?
    likai
        3
    likai  
       2013-12-21 21:36:12 +08:00
    3.0允许了,
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4040 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:23 · PVG 13:23 · LAX 22:23 · JFK 01:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.