# HG changeset patch # User Tyler G. Hicks-Wright # Date 1334347635 21600 # Fri Apr 13 14:07:15 2012 -0600 # Node ID b61dc9da6c57790976004dbac0f3d147afd9db1b # Parent 73a01e9b297c5de2df26025ab7e83db51246e26a Add examples to the docs. diff --git a/docs/examples.rst b/docs/examples.rst --- a/docs/examples.rst +++ b/docs/examples.rst @@ -1,4 +1,26 @@ Examples ======== -TODO + >>> 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'