A thin async wrapper of MPESA daraja API.
Project description
aiompesa
A package for accessing the MPESA Daraja API from asyncio.
Usage
import asyncio
from aiompesa import Mpesa
CONSUMER_KEY = "nF4OwB2XiuYZwmdMz3bovnzw2qMls1b7"
CONSUMER_SECRET = "biIImmaAX9dYD4Pw"
loop = asyncio.get_event_loop()
mpesa = Mpesa(True, CONSUMER_KEY, CONSUMER_SECRET)
token_response = loop.run_until_complete(mpesa.generate_token())
access_token = token_response.get("access_token", None)
expires_in = token_response.get("expires_in", None)
if access_token is None:
print("Error: Wrong credentials used to get the access_token")
else:
print(f"access_token = {access_token}, expires_in = {expires_in} secs")
Requirements
- Python 3.6+
Installation
$ pip install aiompesa
Motivation
- To learn a little more about
asyncio
and put it to some practise. - To develop an async wrapper for the Safaricom daraja api.
Contribution
Follow the contribution guidelines
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
aiompesa-0.0.4.tar.gz
(7.1 kB
view details)
Built Distribution
File details
Details for the file aiompesa-0.0.4.tar.gz
.
File metadata
- Download URL: aiompesa-0.0.4.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | babc343254d1fad04154f20cc2112625754284eefdad7561e68355d85f481b9e |
|
MD5 | b04b1e4cf304179d16f4d1e40f53e799 |
|
BLAKE2b-256 | bb9456a572ed8f0e3e2e593b4d624b48ef8dc7c45b3d00589f5f5bb362ef301a |
File details
Details for the file aiompesa-0.0.4-py2-none-any.whl
.
File metadata
- Download URL: aiompesa-0.0.4-py2-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18c83c102671a72bc33b13631fa3ddecb6a259656f6347a3e5c31a133965a7e4 |
|
MD5 | 689ab6da052555d3cf3b81e53b17f677 |
|
BLAKE2b-256 | 9e9a70c715ebfa21ffedbfc98fcbd534bbf495c291fdf1f8b8b3ef3037c882bd |