Developers > Code library for Python
This library is released under the BSD license.
python setup.py install.
There are many files in the
test/ subdirectory, which can be used
as a tutorial. They are very simple and well documented. We'll run through
test/thing.py as an example.
- # -*- coding: utf-8 -*-
- * likeorhate.com
- * Copyright (c) 2008-2010 likeorhate.com
- * Released under BSD license.
- import likeorhate.likeorhate, likeorhate.thing
- # get the base singleton. We can use it to set some basic data
- loh = likeorhate.likeorhate.LikeOrHate()
- # Use the sandbox server. We can mess it as much as we want, so it's great for
- # debugging. Use "production" when your application is deployed.
- # construct the thing
- thing = likeorhate.thing.Thing(0, 'likeorhate.com')
- # get basic information
- base = thing.getBase()
- if base['status']:
- print 'Base: '
- print base
- print "Error getting base.\n"
- # get extended information
- information = thing.getInformation()
- if information['status']:
- print 'information: '
- print information
- print "Error getting information.\n"
- # get 5 comments, starting at 0,
- comments = thing.getComments(0, 5)
- if comments['status']:
- print 'comments: '
- print comments
- print "Error getting comments.\n"
- # get trackback information
- trackback = thing.getTrackback(0, 5)
- if trackback['status']:
- print 'Trackback: '
- print trackback
- print "Error getting trackback.\n"