pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

pastebin - collaborative debugging tool View Help


Posted by Carlos Scheidegger on Tue 2 Jun 22:48
report abuse | download | new post

  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)

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post