Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
[PYTHON]Twitter client
  • chroniccommand
    Posts: 1,389
    I finally got my python twitter client working(sorta). Anyway here is the code. The reason I said sorta is because I havn't integrated writing on your wall yet only reading from it.

    #!/usr/bin/python
    #Simple twitter client
    #By chroniccommand
    #Lets import the modules
    import sys, twitter, string, os, time
    username = \"pythontest1234\" #Username
    password = \"your_password\" #Password
    api = twitter.Api(username=username, password=password) #Declaring twitter API with usrname/passwrd
    statuses = api.GetFriendsTimeline(username) # Grabs statuses
    for s in statuses :
    print s.user.name.encode(\"utf-8\"), \"(\", s.user.screen_name, \") :\" #Grabbing shit to print out in UTF-8
    print s.text.encode(\"utf-8\")
    print

    status = 'Python test(yes another one x2)' #Our status update message
    api.PostUpdate(status) #Post the message above ^^
    time.sleep(5) #Sleep for 5 second
    sys.exit()#And woot were done ^_^


    This is a continuing project. Next I hope to add ability to write on your wall and maybe even a GUI. Thats it for now.
    NOTE: You must first download the latest tarball from http://code.google.com/p/python-twitter/downloads/list
    And install the Twitter module otherwise you will get an error when compiling the application.
  • Xin
    Posts: 3,251
    IF you believe its a worthy/interesting project feel free to add it to the projects section, and it will get its own subforum where members can edit and improve it.
    Xin
  • A few tips.
    1. Use Python 3
    2. Use urllib, because atm your just using a Twitter module, which is way to easy.
    3. Learn XML or json.
    4. Make your own Twitter module, then you can build the GUI neatly on top of it.