... because from time to time I'm a web developer, too
About me
Projects
Contact
Links

django + blip.pl: automatic new statuses

January 12, 2010 | python
author: Karol Zielinski | comments: 5 | views: 1859
Tags: , , , , ,

blip.pl is a Polish microblogging service (some kind of Polish twitter). Today I’d like to present how to integrate python application (django application) with blip.pl API.

First of all… full documentation of blip.pl API is available here: http://blip.pl/api-0.02.html

It’s in Polish, however if you want to integrate your app with this service you propably know Polish (if not – notice, that it works as a standard REST + JSON compilation, so it shouldn’t be a problem to implement this functionality even for someone, who doesn’t Polish).

Ok, stop talking, start coding…

Open *.py file with your model and change “save()” method:

def save(self):
    if not self.id:
        if self.blip_message:
	        import httplib, base64
	        from django.utils import simplejson

  	        http_url = 'http://api.blip.pl/updates'
                API_HEADERS = {
	            'Content-Type' : 'application/json',
	            'X-Blip-api' : '0.02',
	            'User-Agent' : 'Karol Zielinski blip API',
	            'Authorization' : 'Basic %s' % (base64.b64encode('BLIP.PL_USERNAME:BLIP.PL_PASSWORD'))
	        }

	        update = {}
	        update['body'] = self.blip_message

	        post_params = simplejson.dumps(update)

	        connection = httplib.HTTPConnection('api.blip.pl')
	        connection.request('POST', http_url, headers=API_HEADERS, body=post_params)

	        response = connection.getresponse()
	        headers = response.getheaders()
	        status = response.status
	        resp_data = response.read()

and that’s all.

After you will add new item to this model – message from attribute blip_message will be added to your account on blip.pl.

Easy, isnt’t it?

Bookmark and Share
Post django + blip.pl: automatic new statuses to develway Post django + blip.pl: automatic new statuses to Delicious Post django + blip.pl: automatic new statuses to Digg Post django + blip.pl: automatic new statuses to Facebook Post django + blip.pl: automatic new statuses to Reddit Post django + blip.pl: automatic new statuses to StumbleUpon

Related news and resources

Comments (5)

4Avatars v0.3.1 v0.3.1
django + blip.pl: automatyczne nowe wiadomości - develway.pl - wiadomości dla programistów, wiadomości IT, świeże linki ze świata IT
January 12, 2010, 7:51 am

[...] tech.karolzielinski.com Follow us on Twitter 1,521 śledzących RSS Feed 173 czytelników django + blip.pl: automatyczne nowe wiadomości 1 głosuj! Jak przy wykorzystaniu API serwowanego przez blip.pl stworzyć mechanizm, [...]

4Avatars v0.3.1 v0.3.1
after.design
January 12, 2010, 8:02 am

Używanie base64 jest lekko niebezpieczne dlatego do api blipowego wprowadzono oauth: http://blip.pl/api-oauth.html

4Avatars v0.3.1 v0.3.1
django + twitter.com: automatic new statuses
January 14, 2010, 7:30 am

[...] we created functionality for automatic adding of statuses to blip.pl. Today we would like to do the same thing, however for adding statuses to twitter.com. It will be [...]

4Avatars v0.3.1 v0.3.1
Karol Zielinski
January 14, 2010, 7:39 am

@after.design

I know that base64 is not so safe. However this way is much faster to implement.

4Avatars v0.3.1 v0.3.1
Bruce
May 19, 2010, 6:51 am

[...] we created functionality for automatic adding of statuses to blip.pl. Today we would like to do the same thing, however for adding statuses to twitter.com. It will be [...]

Write a comment

Karol Zielinski :: Just a tech stuff Hello, I'm Karol Zielinski, internet evangelist, an entrepreneur, project manager and a web developer from Gdynia, Poland. I like creative design, good advertisement, social media and all kind of stuff around the web.

Most popular posts

Much more links

Karol Zielinski    |   contact me
Gdynia, Poland
RSS - Just a tech stuff - python, java blog - web development blog Karol Zielinski on twitter Karol Zielinski on LinkedIn Karol Zielinski on facebook Karol Zielinski on delicious Karol Zielinski on digg Karol Zielinski on flickr Karol Zielinski on stumbleupon Karol Zielinski on technorati