
Twitter มี API ที่ใช้งานง่ายที่หนึ่ง ตัวอย่างคือใช้ python ซึ่งทำให้ง่ายไปอีก
เริ่มจาก โหลด API http://code.google.com/p/python-twitter/
ในกรณีนี้ผมใช้ผ่าน mercurial
จากนั้น install 
- 
hg clone https://python-twitter.googlecode.com/hg/ python-twitter
 - 
cd python-twitter/
 - 
sudo python setup.py install
 
จากนั้น เริ่มเขียนครับ
- 
sake@sake-laptop:~/project/python-twitter/examples$ python
 - 
Python 2.6.4+ (r264:75706, Jan 31 2010, 22:10:28)
 - 
[GCC 4.4.3] on linux2
 - 
Type "help", "copyright", "credits" or "license" for more information.
 - 
>>> import twitter
 - 
>>> api = twitter.Api()
 - 
>>> api = twitter.Api(username="myusername",password="mypassword")
 - 
>>> api.PostUpdate(u'ทดสอบโพสภาษาไทย โดยใช้ python-twitter')
 
กรณีจะดึงข้อมูลก็ง่ายดาย
- 
>>> import twitter
 - 
>>> api = twitter.Api()
 - 
>>> api = twitter.Api(username="myusername",password="mypassword")
 - 
>>> statuses = api.GetPublicTimeline()
 - 
>>> print [s.user.name for s in statuses]
 
Tags: 




