Mercurial > hg > bitsytweet
comparison bitsytweet/__init__.py @ 7:dfbb21128332
merge commit
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 25 Nov 2010 13:09:23 -0800 |
parents | 3cb8ad35fe62 da132a64926e |
children | 76b8f41da4cf |
comparison
equal
deleted
inserted
replaced
6:3cb8ad35fe62 | 7:dfbb21128332 |
---|---|
1 """ | 1 """ |
2 BitsyTweet | 2 BitsyTweet - tweet your bitsyblog entries (horrid, I know) |
3 """ | 3 """ |
4 | 4 |
5 import sys | 5 import sys |
6 import twitter | 6 import twitter |
7 | 7 |
14 self.api = twitter.Api(username=self.username, password=self.password) | 14 self.api = twitter.Api(username=self.username, password=self.password) |
15 | 15 |
16 def __call__(self, blog_entry, url): | 16 def __call__(self, blog_entry, url): |
17 if blog_entry.privacy == 'public': # only tweet public blogs | 17 if blog_entry.privacy == 'public': # only tweet public blogs |
18 tweet = '%s : %s' % (blog_entry.snippet(), url) | 18 tweet = '%s : %s' % (blog_entry.snippet(), url) |
19 self.api.PostUpdate(tweet) | 19 print 'Tweeting: %s' % tweet |
20 try: | |
21 self.api.PostUpdate(tweet) | |
22 except Exception, e: | |
23 print >> sys.stderr, "Couldn't tweet %s (%s)" % (url, e) | |
24 print '</tweet>' | |
20 | 25 |
21 def main(args=sys.argv[1:]): | 26 def main(args=sys.argv[1:]): |
22 """debugging front-end for BitstTweet""" | 27 """debugging front-end for BitstTweet""" |
23 | 28 |
24 usage = "%prog [options] tweet" | 29 usage = "%prog [options] tweet" |