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

Get number of your twitter followers in python

January 18, 2010 | frameworks, python
author: Karol Zielinski | comments: 2 | views: 1559
Tags: , , ,

We already know how to implement functionality for automatic adding statuses to twitter. Today we will implement a functionality for automatic downloading a number of your twitter followers in python (django).

 

Everything via twitter API.

We will use only one method from this API, so we need to read “Twitter REST API Method: followers ids” section in this documentation. You can find this section here.

Let’s fun.

We will download amount of followers of @develway. That’s an account of a website for IT specialists and programmers.

Open *.py file (for example main/views.py) and add there a new method:

def downloadTwitterFollowers(request):
	import urllib2, urllib
    from django.utils import simplejson

	request = urllib2.Request('http://twitter.com/followers/ids.json?screen_name=develway&cursor=-1')
	response = urllib2.urlopen(request)

	ids = response.read()
	ids = simplejson.loads(ids)

	followers = len(ids['ids'])

	return HttpResponse('Amount of followers: ' + str(followers))

Now add new view to your urls.py

Open the urls.py file and add there something like:

(r'^download-twitter-followers/$', 'ourProject.main.views.downloadTwitterFollowers'),

Save it and try to run http://yourdomain.com/download-twitter-followers/ in your web browser.

Easy, isn’t it?

Bookmark and Share
Post Get number of your twitter followers in python to develway Post Get number of your twitter followers in python to Delicious Post Get number of your twitter followers in python to Digg Post Get number of your twitter followers in python to Facebook Post Get number of your twitter followers in python to Reddit Post Get number of your twitter followers in python to StumbleUpon

Related news and resources

Comments (2)

4Avatars v0.3.1 v0.3.1
Pobieramy liczbę followersów w pythonie - develway.pl - wiadomości dla programistów, wiadomości IT, świeże linki ze świata IT
January 18, 2010, 5:04 am

[...] tech.karolzielinski.com Follow us on Twitter 5 śledzących RSS Feed 185 czytelników Pobieramy liczbę followersów w pythonie 1 głosuj! W jaki sposób zaimplementować (w pythonie/django) funkcjonalność [...]

4Avatars v0.3.1 v0.3.1
Get number of your subscribers from Feedburner
January 27, 2010, 4:54 am

[...] we already know how to create script for getting number of followers from twitter – now it’s the best time for getting number of subscribers from feedburner. Everything [...]

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