Advertisement
Guest User

Carlos Scheidegger

a guest
Jun 2nd, 2009
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. # This dumb script is public domain. Have fun with it! If it pees on
  4. # your carpet, it's not my fault!
  5.  
  6. # You'll need http://code.google.com/p/python-twitter/, and this
  7. # script currently uses a patch that's not incorporated in the
  8. # trunk. If you feel inclined, just hack the source to catch a
  9. # urllib2.HTTPError in the method GetUser().
  10.  
  11. import twitter
  12. import sys
  13. api = twitter.Api(username='YOUR_USERNAME_GOES_HERE',
  14. password='YOUR_PASSWORD_GOES_HERE')
  15.  
  16. msg = sys.argv[1:]
  17. at_user = None
  18.  
  19. if msg[0].startswith('@'):
  20. try:
  21. at_user = api.GetUser(msg[0][1:]).GetId()
  22. except TwitterError:
  23. sys.stderr.write("Could not find user %s. Ignoring.\n" % msg[0][1:])
  24. msg = msg[1:]
  25.  
  26. api.PostUpdate(" ".join(msg), in_reply_to_status_id=at_user)
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement