https://github.com/musale/aiompesa
A thin async wrapper of MPESA daraja API.
https://github.com/musale/aiompesa
asyncio mpesa mpesa-api python python3
Last synced: 4 months ago
JSON representation
A thin async wrapper of MPESA daraja API.
- Host: GitHub
- URL: https://github.com/musale/aiompesa
- Owner: musale
- License: mit
- Created: 2019-06-19T11:06:52.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-28T08:32:48.000Z (about 2 years ago)
- Last Synced: 2024-11-19T06:12:04.423Z (5 months ago)
- Topics: asyncio, mpesa, mpesa-api, python, python3
- Language: Python
- Homepage: http://bit.ly/aiompesa
- Size: 8 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/musale/aiompesa)
[](https://codecov.io/gh/musale/aiompesa)
[](https://www.codacy.com/app/musale/aiompesa?utm_source=github.com&utm_medium=referral&utm_content=musale/aiompesa&utm_campaign=Badge_Grade)# aiompesa
A package for accessing the [MPESA Daraja API](https://developers.safaricom.co.ke>) from [asyncio](https://docs.python.org/3/library/asyncio.html>).
## Usage
```python
import asyncio
from aiompesa import MpesaCONSUMER_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](https://developers.safaricom.co.ke).## Contribution
Follow the [contribution guidelines](https://github.com/musale/aiompesa)