Coder Social home page Coder Social logo

figo's Introduction

python-figo Build Status PyPi Version

Python bindings for the figo Connect API: http://docs.figo.io

Usage

First, you've to install the package:

pip install python-figo

Now you can create a new session and access data:

from figo import FigoSession

session = FigoSession("ASHWLIkouP2O6_bgA2wWReRhletgWKHYjLqDaqb0LFfamim9RjexTo22ujRIP_cjLiRiSyQXyt2kM1eXU2XLFZQ0Hro15HikJQT_eNeT_9XQ")

# print out a list of accounts including its balance
for account in session.accounts:
    print account
    print account.balance

# print out the list of all transactions on a specific account
for transaction in session.get_account("A1.2").transactions:
    print transaction

It is just as simple to allow users to login through the API:

import webbrowser
from figo import FigoConnection, FigoSession

connection = FigoConnection("<client ID>", "<client secret>", "http://my-domain.org/redirect-url")

def start_login():
    # open the webbrowser to kick of the login process
    webbrowser.open(connection.login_url(scope="accounts=ro transactions=ro", state="qweqwe"))

def process_redirect(authentication_code, state):
    # handle the redirect url invocation, which gets passed an authentication code and the state (from the initial login_url call)

    # authenticate the call
    if state != "qweqwe":
        raise Exception("Bogus redirect, wrong state")

    # trade in authentication code for access token
    token_dict = connection.convert_authentication_code(authentication_code)

    # start session
    session = FigoSession(token_dict["access_token"])

    # access data
    for account in session.accounts:
        print account.name

You can find more documentation at http://python-figo.readthedocs.org

Demos

In this repository you can also have a look at a simple console(console_demo.py) and web demo(web_demo). While the console demo simply accesses the figo API, the web demo implements the full OAuth flow.

figo's People

Contributors

02strich avatar lilithwittmann avatar mrh-line avatar dschurholz avatar cyroxx avatar

Watchers

 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.