Leggi il mio nuovo blog!

Code Project: control Digg with Python

Everyone knows that Digg is a hugely popular social news website where like-minded folks gather and flame each other to death. But if you’re a Digg user and want to flex your coding skills to get a little more from the site, we’ve got the perfect code project for you: we’re going to show you how to write a Python app to read Digg submissions and geo-locate them using GeoIP.

You should know that, even though there’s a perfectly reasonable – if slightly out of date – API for Digg, we’re going to create our own miniature one instead that does just what we need. If you want to go further you’ll find this an easy place to start, and it also gives you some good practice in working with XML.

Many sites use a particular form of communication for their API and some use several. Of these, the most popular are JSON and XML. JSON is simpler and easy to integrate into JavaScript, which is why it often pops up. XML is bigger, chunkier and prettier. It’s also slightly easier to follow, but you end up with swathes of response even for a simple query. Still, it’s what we’ll use here.

To be fair, there isn’t a great deal of difference between them, but XML is the lingua franca of the web, so if you can handle API calls through XML, it will stand you in good stead.

Python handles XML well and has an established module for manipulating it, but we’re getting ahead of ourselves. The first thing we need to do is determine how we can interact with the Digg API in the first place. And, as with many web-savvy social websites, Digg has lots of documentation for programmers on how to use the API. Yay!

Via TuxRadar

One Response to “Code Project: control Digg with Python”

  1. Trackback - Cheap Internation Call >> How to make cheap international call Says:

    ,[...] http://www.kikoweb.org is other relavant source on this subject,[...]

Leave a Reply