Skip to main content

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

Release files for aiompesa 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiompesa 0.0.4
File Size Uploaded
aiompesa-0.0.4.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiompesa 0.0.4
File Interpreter ABI Platform
aiompesa-0.0.4-py2-none-any.whl Python 2 none any Details

Total release size: 15.3 kB

Release files / aiompesa-0.0.4.tar.gz

Download URL aiompesa-0.0.4.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
babc343254d1fad04154f20cc2112625754284eefdad7561e68355d85f481b9e
BLAKE2b-256 checksum
How to use checksums
bb9456a572ed8f0e3e2e593b4d624b48ef8dc7c45b3d00589f5f5bb362ef301a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / aiompesa-0.0.4-py2-none-any.whl

Download URL aiompesa-0.0.4-py2-none-any.whl
Size 8.2 kB
Tags Python 2
SHA-256 checksum
How to use checksums
18c83c102671a72bc33b13631fa3ddecb6a259656f6347a3e5c31a133965a7e4
BLAKE2b-256 checksum
How to use checksums
9e9a70c715ebfa21ffedbfc98fcbd534bbf495c291fdf1f8b8b3ef3037c882bd
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page