Hot Recharge
library to do hot recharge transactions via a web service
Library installation
$ pip install -U hot-recharge
Library Usage
- Refer to the hot recharge web service doc
doing get requests
- the example file
get_tests.pyshow how to do basic get requests for different services - Check out get_tests.py
import HotRecharge
import pprint
credentials = {
'code': '<your-code>',
'pswd': '<your-password',
'ref': '<agent-reference>'
}
# to use random code generated references, flag it to True
api = HotRecharge.HotRecharge(headers=credentials, use_random_ref=True)
try:
# get wallet balance
wallet_bal_response = api.walletBalance()
# get end user balance
end_user_bal_resp = api.endUserBalance(mobile_number='077xxxxxxx')
# get data bundles
data_bundles_resp = api.getDataBundles()
print("Wallet Balance: ")
pprint.pprint(wallet_bal_response)
print("End User Balance: ")
pprint.pprint(end_user_bal_resp)
print("Data Bundles Balance: ")
pprint.pprint(data_bundles_resp)
except Exception as ex:
print(f"There was a problem: {ex}")
Recharge
Recharge data bundles
- use bundle product code
- an optional customer sms can be send together upon request
- Place holders used include
%AMOUNT% $XXX.XX
%COMPANYNAME% As Defined by Customer on the website www.hot.co.zw
%ACCESSNAME% Defined by Customer on website – Teller or Trusted User or branch name
%BUNDLE% Name of the Data Bundle
- Example script recharge_databundles.py
import HotRecharge
import sys
from pprint import pprint
credentials = {
'code': '<your-code>',
'pswd': '<your-password',
'ref': '<agent-reference>'
}
# to use random code generated references, flag it to True
api = HotRecharge.HotRecharge(headers=credentials, use_random_ref=False)
try:
# recharge data bundle with a (OPTIONAL) custom Customer SMS, max char should not exceed 135
# uses places holders as used on hot recharge registration
customer_sms = " Amount of %AMOUNT% for data %BUNDLE% recharged! " \
" %ACCESSNAME%. The best %COMPANYNAME%!"
# can check length first if not sure
if len(customer_sms) > 135:
print("Too many chars for custom customer sms.")
sys.exit()
# need to update reference manually, if `use_random_ref` is set to False
api.updateReference('383yd3')
response = api.dataBundleRecharge(product_code="<bundle-product-code>", number="077xxxxxxx", mesg=customer_sms)
pprint(response)
except Exception as ex:
print(f"There was a problem: {ex}")
recharge pinless
- Example script available at recharge_pinless
import HotRecharge
import sys
credentials = {
'code': '<your-code>',
'pswd': '<your-password',
'ref': '<agent-reference>'
}
# to use random code generated references, flag it to True
api = HotRecharge.HotRecharge(headers=credentials, use_random_ref=False)
try:
# recharge pinless with a (OPTIONAL) custom Customer SMS, max char should not exceed 135
# uses places holders as used on hot recharge registration
customer_sms = "Recharge of %AMOUNT% successful" \
"Initial balance $%INITIALBALANCE%" \
"Final Balance $%FINALBALANCE%" \
"Thank you for using %COMPANYNAME%"
# can check length first if not sure
if len(customer_sms) > 135:
print("Too many chars for custom customer sms.")
sys.exit()
# can update reference manually, if `use_random_ref` is set to False
api.updateReference('37ehd93')
response = api.rechargePinless(amount=0.5, number="077xxxxxxx", mesg=customer_sms)
print(response)
pass
except Exception as ex:
print(f"There was a problem: {ex}")
Metadata
Release files for hot-recharge 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hot-recharge-1.0.0.tar.gz | 2.8 kB | Without provenance | Details for hot-recharge-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hot_recharge-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for hot_recharge-1.0.0-py3-none-any.whl |
Total release size: 6.1 kB
Release files / hot-recharge-1.0.0.tar.gz
| Download URL | hot-recharge-1.0.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af939f99563a28d8f65d0a6a2c2afe4219f1285833b217a31281897df83a4cc4
|
|
BLAKE2b-256 checksum How to use checksums |
8b7feff6aa86c7861e1db774d0f492a431c4080e82614745e9eed1b5ab2e8476
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Release files / hot_recharge-1.0.0-py3-none-any.whl
| Download URL | hot_recharge-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4180b0a10c2afab1145bd10bbca25ce583f6a5805171db806c30bc62749a0911
|
|
BLAKE2b-256 checksum How to use checksums |
e0012e7cfc686c5f6281493d246c7f01aa16ee60eab2c634cebcd86112d59843
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Security for hot-recharge 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.