All Projects → pawelad → pymonzo

pawelad / pymonzo

Licence: MIT license
An - dare I say it - awesome Python Monzo public API wrapper.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pymonzo

tmdbv3api
A lightweight Python library for The Movie Database (TMDb) API. The TMDb API is a resource for developers to integrate movie, TV show and cast data along with posters or movie fan art.
Stars: ✭ 145 (+705.56%)
Mutual labels:  api-wrapper
Finance-Robinhood
Trade stocks and ETFs with free brokerage Robinhood and Perl
Stars: ✭ 42 (+133.33%)
Mutual labels:  api-wrapper
Swiftfall
Wrapper for Scryfall API written in Swift
Stars: ✭ 21 (+16.67%)
Mutual labels:  api-wrapper
starling-developer-sdk
The official JavaScript development kit for building on the Starling API
Stars: ✭ 45 (+150%)
Mutual labels:  api-wrapper
ksoftapi.py
Official API Wrapper for KSoft.Si API
Stars: ✭ 31 (+72.22%)
Mutual labels:  api-wrapper
nyxx
Wrapper around Discord API for Dart
Stars: ✭ 217 (+1105.56%)
Mutual labels:  api-wrapper
e621-api-docs
Documentation library for the e621's API
Stars: ✭ 34 (+88.89%)
Mutual labels:  api-wrapper
Pyblox
An API wrapper for Roblox written in Python. (Receives Updates)
Stars: ✭ 30 (+66.67%)
Mutual labels:  api-wrapper
PUBGSharp
C# wrapper for PUBG stats API
Stars: ✭ 24 (+33.33%)
Mutual labels:  api-wrapper
discord.bat
🗑️ the BEST discord lib
Stars: ✭ 38 (+111.11%)
Mutual labels:  api-wrapper
Binance-Asset-Manager
Extension of binance-python to automatically calculate balances and trade any trading pair.
Stars: ✭ 21 (+16.67%)
Mutual labels:  api-wrapper
node-youtube-music
Unofficial YouTube Music API for Node.js
Stars: ✭ 34 (+88.89%)
Mutual labels:  api-wrapper
HerePy
A library that provides a Python interface to the HERE APIs.
Stars: ✭ 73 (+305.56%)
Mutual labels:  api-wrapper
investopedia simulator api
A simple Python API for Investopedia's stock simulator games. This programmatically logs into Investopedia and can retrieve portfolio summary, get stock quotes & option chain lookups, execute trades - buy & sell shares, puts, calls, sell short, etc.
Stars: ✭ 22 (+22.22%)
Mutual labels:  api-wrapper
meetupr
R interface to the meetup.com API
Stars: ✭ 76 (+322.22%)
Mutual labels:  api-wrapper
FTX.Net
No description or website provided.
Stars: ✭ 31 (+72.22%)
Mutual labels:  api-wrapper
flickr-objects
An object-oriented wrapper for the Flickr API.
Stars: ✭ 29 (+61.11%)
Mutual labels:  api-wrapper
hikari-lightbulb
The official unofficial command handler for the Python discord API wrapper library, Hikari.
Stars: ✭ 152 (+744.44%)
Mutual labels:  api-wrapper
Vestaboard
An API Wrapper for Vestaboards written in Python
Stars: ✭ 23 (+27.78%)
Mutual labels:  api-wrapper
pirant
devRant API wrapper in Python
Stars: ✭ 17 (-5.56%)
Mutual labels:  api-wrapper

pymonzo

Build status Test coverage PyPI version Python versions License

An - dare I say it - awesome Python wrapper for Monzo public API.

It creates a layer of abstraction and returns Python objects instead of just passing along received JSONs. It also deals with authentication and allows using either an access token or fully authenticate via OAuth 2 that's a PITA to set up but automatically refreshes in the background.

The library currently does not implement feed items, webhooks and attachments endpoints - they were't essential to my current needs and they could be completely different in the future - per docs:

The Monzo API is under active development. Breaking changes should be expected.

With the above disclaimer from Monzo, pymonzo is as stable as it gets before the actual API becomes stable, at which point I'm planning to fully implement all of its endpoints and release version 1.0.

Installation

From PyPI:

$ pip install pymonzo

Authentication

Access token

If you want to just play around then you can simply get the access token taken from Monzo API Playground, either pass it explicitly to MonzoAPI() class or save it as an environment variable ($ export MONZO_ACCESS_TOKEN='...') and you're good to go. Everything works as expected but the token is valid only for couple of hours.

OAuth 2

The second authentication option is to go through OAuth 2, which doesn't sound bad (everyone is using it!) but from my experience is a PITA when setting up for server side applications. So.

Some technical background: Monzo currently only allows OAuth 2 'authorization code' grant type and automatic token refreshing is only allowed for 'confidential' clients.

First, you need to create an OAuth client here. Name and logo don't really matter but you need to set the redirect URL to this repo (https://github.com/pawelad/pymonzo) and make it confidential.

Got it? Cool. You should be redirected to the overview of your new OAuth client (https://developers.monzo.com/apps/oauthclient_XXX). You need two things from that page, the 'Client ID' and 'Client secret'. The last required piece is the auth code, which you can get by creating a link like the one below but with your client ID:

https://auth.getmondo.co.uk/?response_type=code&redirect_uri=https://github.com/pawelad/pymonzo&client_id={{CLIENT_ID}}

You then go to the link and authorise the app. You should get an email with a link back to the GitHub repo which contains the authorization code as an URL parameter, something like:

https://github.com/pawelad/pymonzo?code={{AUTH_CODE}}&state=

You now have all three needed values - client ID, client secret and the auth code. You can now either pass them directly to MonzoAPI() class:

>> from pymonzo import MonzoAPI
>> monzo = MonzoAPI(
    client_id='...',
    client_secret='...',
    auth_code='...',
)

or save them as environment variables and initialize MonzoAPI() without any arguments:

$ export MONZO_CLIENT_ID='...'
$ export MONZO_CLIENT_SECRET='...'
$ export MONZO_AUTH_CODE='...'

That's it! The token is then saved on the disk (~/.pymonzo) and is automatically refreshed when needed, so all this (should) be one time only.

Docs

There's no proper documentation as of now, but the code is commented and should be pretty straightforward to use.

That said - feel free to open a GitHub issues if anything is unclear.

Tests

Package was tested with the help of py.test and tox on Python 2.7, 3.4, 3.5 and 3.6 (see tox.ini).

Code coverage is available at Coveralls.

To run tests yourself you need to run tox inside the repository:

$ git clone https://github.com/pawelad/pymonzo && cd pymonzo
$ pip install tox
$ tox

Contributions

Package source code is available at GitHub.

Feel free to use, ask, fork, star, report bugs, fix them, suggest enhancements, add functionality and point out any mistakes. See CONTRIBUTING.md for more info. Thanks!

Authors

Developed and maintained by Paweł Adamczak.

Released under MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].