Mercurial > hg > bitsytweet
annotate bitsytweet/__init__.py @ 3:50f77774a20a
made tweeting work
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 08 Jul 2010 11:13:43 -0700 |
parents | f0ee545bba37 |
children | ed3c5f7ba348 3cb8ad35fe62 |
rev | line source |
---|---|
0
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
1 """ |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
2 BitsyTweet |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
3 """ |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
4 |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
5 import twitter |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
6 |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
7 class BitsyTweet(object): |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 |
3 | 9 def __init__(self, bitsyblog, username, password): |
2 | 10 self.bitsyblog = bitsyblog |
0
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
11 self.username = username |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
12 self.password = password |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
13 self.api = twitter.Api(username=self.username, password=self.password) |
56a9fb9ad9b4
initial commit of bitsytweet (not yet functional)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 |
3 | 15 def __call__(self, blog_entry, url): |
2 | 16 if blog_entry.privacy == 'public': # only tweet public blogs |
3 | 17 tweet = '%s : %s' % (blog_entry.snippet(), url) |
18 self.api.PostUpdate(tweet) |