# HG changeset patch # User Tyler G. Hicks-Wright # Date 1334268594 21600 # Thu Apr 12 16:09:54 2012 -0600 # Node ID 73a01e9b297c5de2df26025ab7e83db51246e26a # Parent fb85c625193623454739df8fdc4623309b1d4138 Add license and readme. diff --git a/LICENSE b/LICENSE new file mode 100644 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2012, Fog Creek Software, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list +of conditions and the following disclaimer. Redistributions in binary form must +reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the +distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +Python Trello API Wrapper +========================= + +This Python API is simply a wrapper around the [Trello](https://trello.com/) REST API. It uses the [API documentation](https://trello.com/docs/api/index.html) to autogenerate the Python API. + +This repository contains the latest generated version of the Python API (in the `trello` directory), along with the necessary files to regenerate the API. + +Getting Started +--------------- + +To use the Python API, first install it from PyPI using `pip`: + + pip install trello + +or from source: + + python setup.py install + +Once you have it installed, get an app key from [https://trello.com/1/appKey/generate](https://trello.com/1/appKey/generate). It will be a 32-digit hex string. Now you can start using the API + + >>> from trello import TrelloApi + >>> trello = TrelloApi(TRELLO_APP_KEY) + >>> trello.boards.get('4d5ea62fd76aa1136000000c') + { + "closed": false, + "desc": "Trello board used by the Trello team to track work on Trello. How meta!\n\nThe development of the Trello API is being tracked at https://trello.com/api\n\nThe development of Trello Mobile applications is being tracked at https://trello.com/mobile", + "id": "4d5ea62fd76aa1136000000c", + "idOrganization": "4e1452614e4b8698470000e0", + "name": "Trello Development", + "pinned": true, + "prefs": { + "comments": "public", + "invitations": "members", + "permissionLevel": "public", + "voting": "public" + }, + "url": "https://trello.com/board/trello-development/4d5ea62fd76aa1136000000c" + } + +Because the Trello development board is public, we didn't need a user's token, but if we want to access private boards, we'll have to have one. We can get it by calling: + + >>> trello.get_token_url('My App', expires='30days', write_access=True) + 'https://trello.com/1/authorize?key=TRELLO_APP_KEY&name=My+App&expiration=30days&response_type=token&scope=read,write' + +If you send your user to the resulting URL, it will ask them to allow your app access to their account, and then it will give them a token (64-digit hex string) that they will pass back to your app. + + >>> trello.set_token(user_token) + +(*Note: Trello does support OAuth, but the Python API does not have any support for it yet.*) + +Once you have set the user's token, all calls to the API will include that token, as if the user was logged in.