Giter Site home page Giter Site logo

mondo-python's Introduction

Mondo simple python SDK

A simple python SDK for dealing with the Mondo API It deals with tokens and token refreshing behind the scenes

See the docs https://getmondo.co.uk/docs for details.

  1. Download the repository
  2. edit the config.json-editMe- enter your API credentials in that file (you can also put your account details there as defaults)
  3. save / rename it config.json and save in same dir as mondo.py
  4. Use the SDK for fun, profit, and global domination

How do I load the SDK

If you have your API credentials in config.json and have included your Mondo account email address and password you can just do this:

from mondo import MondoClient
account = MondoClient()

All of the methods in the class can accept different account details as parameters, should you open up your app / service to other people, but starting with your own account and defaults makes it easy to play with.

You can also specify the default account details to use in the instantiation of MondoClient.

account = MondoClient('[email protected]','p4ssw0rd')

If that goes well and you don't get any errors...

What can you do?

  • account.get_transactions()

  • account.get_transaction()

  • account.authenticate()

  • account.get_accounts()

  • account.get_primary_accountID()

  • account.create_feed_item()

  • account.register_webhook()

  • account.deliver_token()

  • account.token_refresh()

deliver_token() returns a token for handrolling requests and refreshes it when necessary

The methods above all return JSON rather than request objects (the previous version)

Look at the code and https://getmondo.co.uk/docs for information on what parameters to use to refer to other accounts etc.

What about tokens and refreshing them?

It's all taken care of. If a token expires the code will use the refresh call to get a new one

Example starter code

from mondo import MondoClient
account = MondoClient()

print account.get_accounts()
first_account_id =  account.get_accounts()[0]['id']

trx = account.get_transactions(account.get_primary_accountID(), limit=10)
print trx

singleID = trx[1]['id']
single = account.get_transaction(singleID)
print single


account.register_webhook(url='http://mydomain.com/transactions')

webhooks = account.list_webhooks()
first_webhook = webhooks[0]['id']

account.delete_webhook(first_webhook)




Todo:

  • Add in the functionality to list and remove webhooks

Evolved from original code by Tito Miguel Costa ( https://bitbucket.org/titomiguelcosta/mondo )

mondo-python's People

Contributors

jasonbates avatar icio avatar simonvc avatar

Watchers

 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.