Coder Social home page Coder Social logo

trello-py's Introduction

Python Trello API Wrapper

This Python API is simply a wrapper around the Trello REST API. It uses the API documentation 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. 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.

trello-py's People

Contributors

tghw avatar

Watchers

Luke Granger-Brown avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.