07
Jun

打造自己的twitter API proxy

因为这个onedd.net的twitter api proxy恰好是开源的,恰好又是for google app engine的,所以我们可以搭建自己的proxy。app engine是免费的,但是免费账户在流量上有一定的额度,这也可能导致一个proxy用的人太多之后会down掉,所以给自己留个backup也不错。废话少说,下面记录步骤:
 
1、注册app engine,地址 http://appengine.google.com/ ,有google account很方便的就建立了。

2、建立一个application,如图:

 

 

 

 

 

 

 

 

 

 

3、给自己的application设置一个唯一的id,以后就可以用yourid.appspot.com来访问你的app。

4、下载并安装app engine的sdk,这里 http://googleappengine.googlecode.com/files/GoogleAppEngine_1.1.5.msi ,注意app engine需要python支持,所以你的机器必须先安装python。

5、获取源码,这里 http://code.google.com/p/birdnest/ ,不会下载源码的我这里打了个包供下载。 但是要注意的是开源的项目是会经常更新的。然后把源码解压到某个目录,比如 X:\gae ,用你称手的编辑器打开app.yaml这个文件,把第一行application: nest的nest改成你自己建立的id。

6、上传。打开一个cmd.exe,转到X目录下,执行 appcfg.py update gae , 这个过程中会提示你输入你的gmail账号和密码,然后就大功告成了。

这时就可以用 yourid.appspot.com/api 在Gravity里访问你的twitter了,有兴趣的也可以研究研究源码。

    分享:

39 Responses

  1. 比起说是onedd.net “这个API” 不如说是 “http://nest.appspot.com/” 这个API.

  2. http://code.google.com/p/sdapp/downloads/list
    这里有个Google Appengine的第三方上传工具 可以免装app engine的sdk

  3. 我这appspot.com被封。。。

  4. Halllelujah英年

    不管是用nest.onedd.net/api,还是在即在google app上搭了一个,Gravity里可以用,但是发新推时都会显示sending disabled……
    谁能帮我……

  5. 我按照文中方法上传了birdnest, 之后设定gravity, 更新的时候提示500错误, 很奇怪. 也不知道具体哪里错了

  6. 发现问题所在了. 应该是用branchs/gae里的代码, 而不是trunk里的. 我的api可以用了

  7. 路过学习,嘿~~~

  8. 依葫芦画瓢,也搞定了。请问搞定后安装的这些东西能不能卸载?

  9. 好东西 呵呵

  10. GAE收不到短信验证码,郁闷了。。

  11. 搞定了,多谢

  12. 按照方法可以登录twitter, 但是一刷新,提示Http 500错误,不知道什么原因

  13. 出现“internal server error”错误,这个看别个说是代码里面有问题,你可以尝试删除code.py里面的下面一段代码:
    import socket
    import re
    ua = web.ctx.environ.get(“HTTP_USER_AGENT”, ‘None’)
    if ua.find(‘jibjib’) >= 0:
    socket.setdefaulttimeout(60)
    elif ua.find(‘zh-CN’) >= 0:
    #raise Exception(‘unknown error’)
    socket.setdefaulttimeout(2)
    else:
    socket.setdefaulttimeout(2)

  14. 照LZ的方法搭設失敗,因為本人是個電腦盲,已經很努力了~求API,用在iphone上上twitter。另外搜索怎麼設置?vpn又是什麼意思呢?多謝達人指教!我的郵箱koyoo2009@gmail.com

  15. 我在进行第6步的时候 困扰了,首先是appcfg.py update gae在x:目录里面找不到,而且当我把目录设置在c盘的时候,无法用cmd进入c:的目录。
    小弟菜鸟,求解!

    • cmd命令下进不了C盘目录?不会吧,直接用“C:”命令无法进入吗?

  16. 这里有份资料,供大家参考。

    http://download.csdn.net/source/2697349

    gridtwit_client_oauth_demo_src_0.1.0

    用 C++ 语言实现 twitter 的 oauth 鉴权全过程。另外还有详细的文档试用说明(Demo_Description.doc)。这里拿出来共享,是希望大家在做同类产品时,在 OAUTH 鉴权过程中,可以参考这个,并少花点时间。

    在编码过程中,有个遗留问题是:不知道如何编码实现tweet功能,如有知道的,麻烦告诉我一声,万分感谢!

  17. LZ可以发打包一下上面的源码么? 帖子里的我下载失败额 可以发给我么?zhangqi900909@163.com

  18. Mac版的google app engine下载:http://googleappengine.googlecode.com/files/GoogleAppEngineLauncher-1.4.1.dmg

    下载页面:http://code.google.com/intl/zh-CN/appengine/downloads.html

  19. Thank you a lot for sharing this with all folks you actually recognize what you’re speaking about! Bookmarked. Kindly additionally talk over with my website =). We could have a hyperlink exchange contract between us

  20. 跪求一api 手机用的上推特。邮箱407683768@qq.com

  21. Thanks for the good writeup. It actually was once a enjoyment account it. Look advanced to more brought agreeable from you! However, how can we communicate?

  22. I’m really impressed with your writing talents and also with the structure to your blog. Is that this a paid topic or did you modify it yourself? Anyway stay up the excellent quality writing, it is uncommon to peer a great weblog like this one these days..

在线回复

您填写的邮件地址仅管理员可见 *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    爱范消息 · Exploring Leading Tech

    轻量、专注的消息,关注移动互联网、创投、智能设备的新鲜资讯。需各种邀请码,也请加入列表。

    申请加入请填写 email

    教科书之“变”

    Recent Comments

    • Loading...

    @iflea 爱互易

    ifanr 寻找坐言起行的伙伴,有超强执行力和韧性的战友...iSeek 公榜