Trollop is a Python library for working with the Trello API.
In : from trollop import TrelloConnection In : conn = TrelloConnection(<your developer key>, <user's oauth token>)
The connection object will automatically have a Member object attached, representing the user whose oauth token was used to connect:
In : conn.me Out: <trollop.lib.Member object at 0x101707650> In : conn.me.username Out: u'btubbs'
In the previous example no HTTP request was made until command 4, the access to conn.me.username. Trollop objects are lazy.
The connection object has methods for getting objects by their IDs:
In : card = conn.get_card('4f2e454cefab2bbd4ea71b02') In : card.name Out: u'Build a Python Trello Library' In : card.desc Out: u'And call it Trollop.'
There are convenience properties to automatically look up related objects:
In : lst = card.list In : lst Out: <trollop.lib.List object at 0x101707890> In : lst.name Out: u'Icebox' In : lst.id Out: u'4f17cb04d5c817032301c179' In : len(lst.cards) Out: 20 In : lst.cards[-1].name Out: u'Build a Python Trello Library'
Coverage for creating/updating objects is still really thin. If you'd like to pitch in to finish covering the whole API, please send a pull request with your changes.
Trollop is licensed under the MIT License.