开发者

want to develop a app in python which interacts with the web and posts on facebook , twitter and gtalk?

开发者 https://www.devze.com 2022-12-12 15:54 出处:网络
i want to develop a python desktop app which interacts and posts its con开发者_如何学运维tent on facebook , twitter or gtalk as a message . is it possible?... tutorials and ideas will helpThe Twitter

i want to develop a python desktop app which interacts and posts its con开发者_如何学运维tent on facebook , twitter or gtalk as a message . is it possible?... tutorials and ideas will help


The Twitter API will help you for Twitter, since it's intended to help you post messages. The Facebook API isn't actually what you want - it helps you write applications which run on Facebook, but doesn't necessarily help you communicate with Facebook the way that a user would. To do that you might need to look at how Facebook communicates with a browser - using something like Firebug and Live HTTP Headers and then replicating the browser behaviour using urllib/urllib2 (there is an excellent tutorial here). For gtalk, the underlying implementation is Jabber/XMPP for which you should be able to find plenty of documentation (there's even a book published by O'Reilly).


If you can't find a facebook API to suit your needs, you'll have to make one from scratch. Try using the Charles web debugging proxy to surf around facebook and post comments, add friends etc. It will reveal and log all the headers and GET/POST traffic. You can use the logged requests and responses to engineer your own API. It'll be a pain, but its a good exercise. If you get stuck, just post a query on this website. The issues are all common enough that people post solutions within a few minutes.

A few pointers:

  • Facebook requires a login, meaning you'll probably need to build your own urlopener using a cookie handler from cookielib. You'll also have to get comfortable programming HTTP POST requests.
  • Facebook probably won't tolerate traffic from automated scripts, so all your traffic with the website will have to emulate a browser--slowish request rates, and a strategically defined "user-agent" element in the HTTP request headers.


You can check out APIs of Facebook, Twitter and Gtalk

0

精彩评论

暂无评论...
验证码 换一张
取 消