Skip to main content

EASYMOBILE Python client library

Project description

EASYMOBILE PYTHON API

Overview

easymobile is a Python package that provides a simple interface for integrating with the EASYMOBILE API, allowing users to purchase airtime, data, cable subscriptions etc. This package is designed to streamline the process of interacting with the EASYMOBILE API and offers methods to handle various operations such as fetching available services, purchasing services, and checking transaction statuses.

Available Features

  • Airtime Operations
  • Data Operations
  • Cable Operations

Installation

To install the EasyB2B package, clone this repository and install:

git clone https://github.com/Ephraim-Akolo/EASYMOBILE.git
cd EASYMOBILE
pip install .

or

pip install git+https://github.com/Ephraim-Akolo/EASYMOBILE.git

Usage

Initialization

To use the EASYMOBILE package, you need to initialize the classes with your API key. The API key can be provided during initialization or set in the environmental variable EASYMOBILE_API_KEY.

Airtime Operations

from easymobile import EasyAirtime, get_easyb2b_reference

api_key = 'your_api_key'

easy_airtime = EasyAirtime(api_key=api_key)

# Get Networks
networks = easy_airtime.get_networks()
print(networks)

# Get Airtime Types
airtime_types = easy_airtime.get_airtime_types(network=1)
print(airtime_types)

# Get Airtime Rates
airtime_rates = easy_airtime.get_airtime_rates(network=1, airtimeType='VTU')
print(airtime_rates)

# Purchase Airtime
reference = get_easyb2b_reference()  # Generate a unique reference code
response = easy_airtime.purchase_airtime(reference=reference, network=1, airtimeType='SME', amount='10', phone='08168639124')
print(response)

# Get Transaction Status
status = easy_airtime.get_transaction_status(ref=reference)
print(status)

Data Operations

from easymobile import EasyData, get_easyb2b_reference

api_key = 'your_api_key'

easy_data = EasyData(api_key=api_key)

# Get Networks
networks = easy_data.get_networks()
print(networks)

# Get Data Types
data_types = easy_data.get_data_types(network=1)
print(data_types)

# Get Data Plans
data_plans = easy_data.get_data_plans(network=1, dataType='SME')
print(data_plans)

# Purchase Data
reference = get_easyb2b_reference()  # Generate a unique reference code
response = easy_data.purchase_data(reference=reference, network=1, dataType='SME', planId='1', phone='08168639113')
print(response)

# Get Transaction Status
status = easy_data.get_transaction_status(ref=reference)
print(status)

Cable Operations

from easymobile import EasyCable, get_easyb2b_reference

api_key = 'your_api_key'

easy_cable = EasyCable(api_key=api_key)

# Get Cables
cables = easy_cable.get_cables()
print(cables)

# Get Cable Packages
packages = easy_cable.get_cable_packages(cable_id=1)
print(packages)

# Validate Smartcard/IUC Number
validation = easy_cable.validate_smartcard_iuc_number(cable_id=1, smartcard_no='1234567890')
print(validation)

# Purchase Cable Subscription
reference = get_easyb2b_reference()  # Generate a unique reference code
response = easy_cable.purchase_cable(reference=reference, cable_id='1', package_id='1', smartcard_no='1234567890')
print(response)

# Get Transaction Status
status = easy_cable.get_transaction_status(ref=reference)
print(status)

Running Tests

To run the tests for the EASYMOBILE package, create and/or activate a Python virtual environment, ensure the current working directory is the root directory, and follow these steps:

# Install the test dependencies if not already done
pip install -r test-requirements.txt

# Discover and run tests
python -m unittest

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

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

Source Distribution

easymobile-0.0.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

easymobile-0.0.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file easymobile-0.0.0.tar.gz.

File metadata

  • Download URL: easymobile-0.0.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for easymobile-0.0.0.tar.gz
Algorithm Hash digest
SHA256 a013c79bd8c1a2d5ceb95d734d7aa4b9fbd7e61c64e2bf405d29290795a0b7cf
MD5 421211a46a90c7b40501101fa1b41de0
BLAKE2b-256 6de1d8c4be0617f9d70fe426ce4ea1618c51a591747b03863ed1cfd3d07a73e4

See more details on using hashes here.

File details

Details for the file easymobile-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: easymobile-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for easymobile-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec6458cc7d84f999ec7c3bab34ccf3a1fabff6477c9d4e563b5f6c04cd607650
MD5 4783119074391af3a73cd7d004062a50
BLAKE2b-256 43a8b9707e3cb922efe0f98e81ac47b820d07b23eb3df8a301c3176495af717c

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