Tuesday, July 22, 2008

Twitter Hello-World: that was easy

I'm working on Twitter integration for Tipjoy. It's going to be all about pushing your favorite content out to your friends on twitter, like our FriendFeed integration.

I just finished a 'hello world' integration. Here is the result.

Here is the code:
#!/usr/bin/python
import urllib
import urllib2
import urlparse
username = "tipjoy"
password = "get.your.own"
realm = "Twitter API"
url = 'http://twitter.com/statuses/update.json'
(scheme, netloc, path, params, query, fragment) = urlparse.urlparse(url)
handler = urllib2.HTTPBasicAuthHandler()
handler.add_password(realm, netloc, username, password)
opener = urllib2.build_opener(handler)
text = "hello from python"
data = {'status': text}
encoded_data = urllib.urlencode(dict([(k, unicode(v).encode('utf-8')) for k, v in data.items()]))
url_data = opener.open(url, encoded_data).read()

8 Comments:

At July 22, 2008 at 4:22 PM , Blogger Andy Weissman said...

Can Switchabit help push from TipJoy to Twitter?

 
At July 22, 2008 at 11:34 PM , Blogger Ivan said...

We have RSS feeds for a user's tips and the top/featured/recent content on Tipjoy. I think there are a half dozen tools that can feed that to twitter.

The actual integration with Twitter is trivial. Just a few lines of code. The harder part is the UI and UX on the feed. I'd like the user to be able to add a message, even after they've tipped. I'd like someone to be able to get an @reply tweet with the message. This needs to be integrated into a new bookmarklet and into the page flow.

If you go to Tipjoy now, under each piece of content, you'll see "comments", "share", "view all", etc. - "twitter" might go on that list.

Switchabit would make sense for a few services though. I need to look into it more. We have bigger plans for facebook than just feeding content. We'll replicate the functionality of tipjoy.com and then some.

Dave Fowler from 8aweek/SocialBrowse and I might be making a django module to do what switchabit does. It will be open source probably. We'd like to make reusable components to feed into other services.

 
At July 29, 2008 at 1:51 PM , Blogger Caleb Elston said...

Very cool, excited to see how you integrate some of the more specific integrations points such as @ replies and the like.

 
At July 29, 2008 at 1:56 PM , Blogger Ivan said...

@caleb I was thinking of using @replies to notify people that they've been tipped, especially if they don't yet have tipjoy accounts.

 
At July 29, 2008 at 3:17 PM , Blogger Caleb Elston said...

@Ivan for non TipJoy users where will you get their twitter username from to send them the message?

 
At July 29, 2008 at 3:21 PM , Blogger Ivan said...

The process to find an owner of a page submitted to tipjoy is largely manual. It'll probably be easier to find a link to a twitter stream than find an email address.

 
At December 28, 2009 at 5:44 PM , Blogger liuyanqiu918 said...

This comment has been removed by a blog administrator.

 
At April 21, 2010 at 6:39 PM , Blogger hi said...

GHD GHD
GHD Straighteners GHD Straighteners
GHD Hair Straighteners GHD Hair Straighteners
GHD IV Styler GHD IV Styler
GHD UK GHD UK
Ghd Hair Ghd Hair
Chi Flat Iron Chi Flat Iron
Chi Hair Chi Hair
Ceramic Chi Flat Iron Ceramic Chi Flat Iron
Chi Flat Irons Chi Flat Irons
Chi Hair iron Chi Hair iron
Ghd Iron Ghd Iron
Ghd Flat Iron Ghd Flat Iron
GHD IV MK4 Gold GHD IV MK4 Gold

G Star Raw G Star Raw
G Star G Star
Jeans G Star Jeans G Star
G Star sale G Star sale
G Star shop G Star shop
G Star jeans G Star jeans
G Star jacket G Star jacket
G Star t shirts G Star t shirts
G Star clothing G Star clothing
G Star shoes G Star shoes
G Star raw clothing G Star raw clothing
G Star raw jacket G Star raw jacket
G Star raw jeans G Star raw jeans
G Star raw denim G Star raw denim
G Star raw t shirts G Star raw t shirts
G Star raw shoes G Star raw shoes

uggs uggs
MBT MBT
abercrombie deutschland abercrombie deutschland
ugg boots ugg boots
thomas sabo thomas sabo
ugg boots ugg boots
ed hardy ed hardy
Abercrombie And Fitch Abercrombie And Fitch
tiffany jewelry tiffany jewelry

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home