using python get friend timeline in twit …

using python get friend timeline in twitter. following tools should be used:

python-twitter

python-simplejson

first install python-simplejson, if in ubuntu, just using command as follows

$apt-get install python-simplejson

then, downloading python-twitter , unpackage it. then using command

  $ python setup.py build
  $ python setup.py install

then, open python.

>>> import twitter

>>> api = twitter.Api(“username”, “passworld”)

>>> posts = api.GetFriendsTimeline(‘username’)

>>> print [post.text in post as posts ];

for the file, the script should be liked:

import twitter
class mytwitter():

def __init__(self):
self._config = None

def main():
api = twitter.Api('username', 'passworld')
posts = api.GetFriendsTimeline('username')
for post in posts:
print post.text.encode('utf-8')

if __name__ == "__main__":
main()