PyDigg is a Python toolkit for the Digg API. It provides an object-oriented interface to all of the available endpoints of the API. It is offered under the MIT License.
The toolkit is contained in one module ('digg.py'), made up of one class ('Digg') with several nested classes. It depends on the standard Python libraries 'urllib' and 'xml.dom'.
You will only ever have to instance the root class, 'Digg'. From there it's a matter of using that class instance's methods to retrieve instances of nested classes such as 'Story', 'User', 'Comment', etc. The 'Digg' class contains all methods necessary to access data. Each nested class, such as 'Story', contains convenience methods that redirect back to the methods in "Digg".
The following example outputs the titles of the latest stories submitted to Digg:
from digg import *
d = Digg(APPKEY) #insert your own application key string
stories = d.getStories()
for story in stories:
In the above example, the Digg.getStories() method returns an instance of the 'Stories' container class, which contains n number of 'Story' instances. All response data from the Digg API is accessible by class properties. For instance, the 'User' class has the following properties: name, icon, registered, profileviews. I tried to align my naming conventions with those of the Digg API wherever possible.