Skip to main content

A Python library for working with the Trello api.

Project description

Meet Trollop

Trollop is a Python library for working with the Trello API.

Quick Start

A Trello connection is instantiated with your API key and a user’s oauth token:

In [1]: from trollop import TrelloConnection

In [2]: 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 [3]:
Out[3]: <Member: me>

In [4]:
Out[4]: u'btubbs'

In the previous example no HTTP request was made until command 4, the access to Trollop objects are lazy.

The connection object has methods for getting objects by their IDs:

In [5]: card = conn.get_card('4f2e454cefab2bbd4ea71b02')

In [6]:
Out[6]: u'Build a Python Trello Library'

In [7]: card.desc
Out[7]: u'And call it Trollop.'

You can use normal Python introspection techniques to see the available attributes. They’ll mostly be named exactly as they are in the JSON returned from Trello:

In [13]: dir(card)

The exact parsed JSON returned from is available as the _data attribute on all Trello objects:

In [7]: card._data
{u'badges': {u'attachments': 0,
             u'checkItems': 0,
             u'checkItemsChecked': 0,
             u'comments': 1,
             u'description': True,
             u'due': None,
             u'fogbugz': u'',
             u'votes': 0},
 u'checkItemStates': [],
 u'closed': True,
 u'desc': u'And call it Trollop.',
 u'id': u'4f2e454cefab2bbd4ea71b02',
 u'idBoard': u'4e8df268f14f2517a7a342fa',
 u'idList': u'4f17cb04d5c817032301c179',
 u'idMembers': [],
 u'idShort': 130,
 u'labels': [],
 u'name': u'Build a Python Trello Library',
 u'url': u''}

Trello objects have smart fields that automatically look up related objects:

In [9]: lst = card.list

In [10]: lst
Out[10]: <List: Icebox>

In [11]:
Out[11]: u'Icebox'

In [12]: lst._id
Out[12]: u'4f17cb04d5c817032301c179'

In [13]: len(
Out[13]: 20

In [14]:[-1].name
Out[14]: u'Build a Python Trello Library'

Help Wanted

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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for trollop, version 0.0.17
Filename, size File type Python version Upload date Hashes
Filename, size trollop-0.0.17.tar.gz (8.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page