Skip to main content

A python lib for using Mambu APIs.

Project description

MambuPy

.. image:: https://travis-ci.org/jstitch/MambuPy.svg?branch=master :target: https://travis-ci.org/jstitch/MambuPy :alt: Build Status

A python API for using Mambu.

Allows accessing Mambu via its REST API. Also includes SQLAlchemy mappings to a backup of its DataBase.

Mambu is a cloud platform which lets you rapidly build, integrate, launch and service any lending portfolio into any market (https://www.mambu.com).

Mambu REST API

Mambu allows communicating via a RESTful API (documented at https://developer.mambu.com/).

MambuPy includes a set of classes whose purpose is connecting to this REST Api and work with Mambu entities on your python scripts.

You must configure your Mambu account for allowing an API user to connect with it for this functionality to work.

For more information, look at the MambuStruct class and all the classes inheriting from it. MambuPy implements this at all the scripts named mambu*.py

Mambu Database Backup

Mambu also allows their users to download a dump of its database. It is a MySQL schema, documented at https://developer.mambu.com.

MambuPy includes a set of SQLAlchemy mappings that can connect to the Mambu database dump.

You must download a valid dump of your Mambu database, and then extract and restore on a local MySQL server of your own for this functionality to work.

For more information, look at the scripts named schema*.py

Installation

Currently MambuPy works on Python 2.7 and Python 3.6

You may install MambuPy by git-cloning this repository on your local environment and making it available anywhere on your PYTHONPATH.

You may also use pip install mambupy but please consider that you must configure your installation before using it.

Configuration

You must configure your local MambuPy environment first so you can correctly use this module.

Look at mambuconfig.py for more information.

Work in progress

MambuPy is a work in progress, on a very early stage of its development.

Currently it allows a limited connection to some of the more important Mambu entitites accessible via its REST API.

Also, not all of the Mambu Database schema is currently mapped.

Finally, also note that Mambu itself delivers changes on a regular basis that may include new functionality on its REST API, and changes on its database tables. Currently MambuPy works with the last version of Mambu but NOT ALL of its functionality is implemented. Making a complete implementation of the REST API and the mapping of the Database, and keeping them up to date with the last version of Mambu, is one of the main objectives of the MambuPy project.

Please consider supporting the project by forking, improving and pull-requesting it.

TODOs

TODO comments for hackers are included at:

  • TODO file
  • pydoc string at __init__.py
  • pydoc strings all around the code

Release Notes

  • v0.8 first release notes 2018-04-20

    • implementation of PATCH request method on MambuStruct
    • implementation of MambuTask entity and MambuTasks iterable
    • v0.8.1 and v0.8.2 are identical to v0.8.1
  • v0.8.3 2018-05-22

    • MambuStruct convertDict2Attrs constantFields added 'email'
    • mambuuser unittests
    • mamburoles module
    • MambuUser setRoles() method
    • MambuTask close() method
  • v0.8.4 2018-07-18

    • Sphinx documentation and ReadTheDocs site
  • v0.9.0 2018-08-06

    • reallocation of modules in packages according to functionality
  • v1.0.0 2018-08-31

    • support for Python 3 ready!
  • v1.1.0 2018-12-16

    • config parsers for a better configuration of MambuPy
  • v1.1.1 2018-12-17

    • argparse to override configuration of MambuPy from command line
  • v1.2.0 2019-01-21

    • MambuStruct now holds a copy of the args and kwargs originally passed to the constructor, so they may be reused on future calls of connect() method
  • v1.2.1 2019-02-18

    • MambuStruct catches correctly requests errors and throws MambuCommError only on that cases. Any other exception is re-raised again.
  • v1.2.2 2019-02-19

    • gettasksurl now support limit and offset params
  • v1.3.0 2019-03-06

    • orm schema_tasks script added.
    • rest added properties to each Mambmu entity to support instantiation of attributes with a default related-entity class, allowing overriding this with your own related-entity classes.
  • v1.3.1 2019-03-15

    • bugfix on MambuStruct.\ init\ , urlfunc parameter should be treated almost at the end
  • v1.3.2 2019-03-27

    • get method for dict-like MambuStructs
  • v1.3.3 2019-05-01

    • AllMambuProducts singleton py3 compatibility
  • v1.3.4 2019-05-16

    • add support for DELETE method on MambuStruct connect()
  • v1.3.5 2019-05-28

    • add Mambu Savings related entities (unit test still TODO)
  • v1.3.6 2019-06-11

    • MambuStruct convertDict2Attrs constantFields added 'description'
  • v1.3.7 2019-07-30

    • Auth paramos for backup_db func were incorrectly set
  • v1.3.8 2019-08-26

    • change import builtins for unicode to a more generic way of importing it
  • v1.3.9 2019-10-30

    • MambuGroup support one address via preprocess
  • v1.3.10 2019-12-09

    • MambuStruct support to update info via PATCH and POST
  • v1.3.11 2019-12-10

    • MambuGroups support to create Group entities in Mambu
  • v1.3.12 2019-12-11

    • MamguGroups support to update Group entities in Mambu
  • v1.3.13 2019-12-13

    • MambuClient support to update Client entities in Mambu
  • v1.3.14 2020-01-09

    • MambuGroup method addMembers
  • v1.3.14b 2020-01-09

    • MambuGroup method addMembers update MambuGroup once members are added
  • v1.3.15 2020-01-24

    • mambuutil.backup_db GET call to Mambu needs application/json headers
  • v1.4 2020-01-30

    • ORM gets Centre table
  • v1.5 2020-02-20

    • URL function for loan accounts' custom information
  • v1.6 2020-02-24

    • setHolder getRoles=True instantiates Clients with fullDetails=True
  • v1.7 2020-03-05

    • Accept Headers for all requests, using v1 API Accept Header
  • v1.7.1 2020-04-03

    • Update method comes from parent class MambuStruct, it connects to Mambu to refresh info of updated data in the internal structures of MambuPy
  • v1.8 2020-05-04

    • Implement contains in MambuStruct so that you can use in operator
  • v1.8.1 2020-05-11

    • init method tries to initialize the entid property
  • v1.8.2 2020-07-03

    • Use of items() instead of iteritems in dictionaries
    • Atribute rescheduledAccountKey was added to orm LoanAccount
    • gitlab CI coverage tests
  • v1.8.3 2020-09-05

    • Classes CustomFieldSet and CustomFieldSelection were added for ORM
    • New setBranch method MambuUser
  • v1.8.4 2020-10-30

    • mambuloan missing import datetime fixed
  • v1.8.5 2020-12-16

    • Path in Unittests script fixeed to run from root directory
  • v1.8.6 2021-04-14

    • Add a mambuclintclass for clients set under MambuLoan.setHolder
  • v1.8.7 2021-05-04

    • Backing up Database dump from Mambu, save file using "wb" mode May the 4th be with you!
  • v1.8.8 2021-05-18

    • MambuUser update and updatePatch methods
  • v1.8.9 2021-06-16

    • Add urlfunc to each element obtained during iterable element init
    • MambuStruct.connect() json.loads ValueError now raises MambuError with body content
    • Codesmells fixes
  • v1.8.10 2021-06-29

    • MambuStruct connect() retries on Mambu 500 errors, throwing MambuCommError on RETRIES limit
  • v2.0.0a1 2022-02-18

    • support for Mambu API REST v2, work in progress... check api directory
    • using a loan account as a sample for all development...
    • support for instancing (get and get_all endpoints)
    • support for instancing through search
    • custom fields in entities
    • upload attachments
    • update of entities
  • v2.0.0a2 2022-02-23

    • Mambu API REST v2, support for creation of entities
  • v2.0.0a3 2022-03-08

    • Mambu API REST v2, support for patching entitites
    • MambuAPI REST v2, MambuGroup entity
    • MambuAPI REST v2, MambuClient entity

Author

JNC jstitch@gmail.com

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MambuPy-2.0.0a5.dev1.tar.gz (110.2 kB view details)

Uploaded Source

Built Distributions

MambuPy-2.0.0a5.dev1-py3.10.egg (144.8 kB view details)

Uploaded Source

MambuPy-2.0.0a5.dev1-py3-none-any.whl (158.7 kB view details)

Uploaded Python 3

File details

Details for the file MambuPy-2.0.0a5.dev1.tar.gz.

File metadata

  • Download URL: MambuPy-2.0.0a5.dev1.tar.gz
  • Upload date:
  • Size: 110.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for MambuPy-2.0.0a5.dev1.tar.gz
Algorithm Hash digest
SHA256 322fa384a3e4d5812c6fa4fbcef3297024a89ae0cba2213bf38a55ef742c0c80
MD5 f503b819d3f489ac7cba720ca575e663
BLAKE2b-256 11fdd8b78d70f115f27a7b8d3f260d12a3241138d7f2c4e4a4ca05888c26d85d

See more details on using hashes here.

File details

Details for the file MambuPy-2.0.0a5.dev1-py3.10.egg.

File metadata

  • Download URL: MambuPy-2.0.0a5.dev1-py3.10.egg
  • Upload date:
  • Size: 144.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for MambuPy-2.0.0a5.dev1-py3.10.egg
Algorithm Hash digest
SHA256 5610690d4f7dfdbb2cabd287e5be2552e7c8a1f46dcd39020826026c574e0ffb
MD5 fbd30069bc353ebce3732f0fc7976789
BLAKE2b-256 027ae99b6ee8895a544e3fba77e2e87a391a73ede3b4b8317d4043992e580dd5

See more details on using hashes here.

File details

Details for the file MambuPy-2.0.0a5.dev1-py3-none-any.whl.

File metadata

  • Download URL: MambuPy-2.0.0a5.dev1-py3-none-any.whl
  • Upload date:
  • Size: 158.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for MambuPy-2.0.0a5.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 4529eaeddf7cd4de93d2584c77c6f802bd780cf6809ed53c32b28a1c579aff2d
MD5 647d43eca868b9b13b1d25957bae4df1
BLAKE2b-256 79e05f740a2673366834356ce93b43297de09fd739315369ac5b3818c51d1b00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page