Skip to main content

A Python API Interface for RedPocket Mobile

Project description

python-redpocket

python38|39 Code style: black codecov pypi downloads

A simple, fully tested, Pythonic wrapper around RedPocket Mobile's API.

Example Usage

from getpass import getpass
from redpocket import RedPocket

username = input("RedPocket Username: ")
password = getpass("Password:")

rp = RedPocket(username=username, password=password)

lines = rp.get_lines()
print(lines)
# [
#     RedPocketLine(
#         account_id='12345',
#         number=1234567890,
#         plan='Annual- Unlimited Everything + 8GB high speeds',
#         expiration=datetime.date(2022, 1, 2),
#         family=False
#     )
# ]

line_details = lines[0].get_details()
print(line_details)
# RedPocketLineDetails(
#     number=1234567890, 
#     product_code='GSMA', 
#     status='Active', 
#     plan_id='355', 
#     plan_code='E240GSMA', 
#     expiration=datetime.date(2021, 5, 12), 
#     last_autorenew=datetime.date(2021, 12, 3), 
#     last_expiration=datetime.date(2022, 1, 2), 
#     main_balance=-1, 
#     voice_balance=-1, 
#     messaging_balance=-1, 
#     data_balance=7657, 
#     phone=RedPocketPhone(model='Apple iPhone 12 A2172', imei='', sim='', esn='')

print(line_details.remaining_days_in_cycle)
# 11

print(line_details.remaining_months_purchased)
# 8

There is also a helper function to get all the lines and line details in one call:

from redpocket import RedPocket

rp = RedPocket(username="", password="")
lines = rp.get_all_line_details()

print(lines)
# [
#     (
#         RedPocketLine(
#             account_id='12345', 
#             number=1234567890, 
#             plan='Annual- Unlimited Everything + 8GB high speeds', 
#             expiration=datetime.date(2022, 1, 2), 
#             family=False), 
#         RedPocketLineDetails(
#             number=1234567890, 
#             product_code='GSMA', 
#             status='Active', 
#             plan_id='355', 
#             plan_code='E240GSMA', 
#             expiration=datetime.date(2021, 5, 12), 
#             last_autorenew=datetime.date(2021, 12, 3), 
#             last_expiration=datetime.date(2022, 1, 2), 
#             main_balance=-1, 
#             voice_balance=-1, 
#             messaging_balance=-1, 
#             data_balance=7657, 
#             phone=RedPocketPhone(model='Apple iPhone 12 A2172', imei='', sim='', esn='')
#         )
#     )
# ]

If you know the hash or account number of the specific account you want to retrieve, you can do that as well:

from redpocket import RedPocket

rp = RedPocket(username="", password="")

my_line_hash = rp.get_lines()[0].account_hash
print(my_line_hash)
# 'MTIzNDU2'

details = rp.get_line_details(account_hash=my_line_hash)
print(details)
# RedPocketLineDetails(
#     ...
# )

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

python-redpocket-0.3.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

python_redpocket-0.3.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file python-redpocket-0.3.1.tar.gz.

File metadata

  • Download URL: python-redpocket-0.3.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.7 Darwin/20.3.0

File hashes

Hashes for python-redpocket-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b01fd65365ef751d1672e954b940376fa70004606359fc7616d28dc3bb991d22
MD5 80f06870d46b8a0fe84f82ac0f7bee09
BLAKE2b-256 bffb2efbea4a3e86025732e57212cd4eff33fb43a7c6697875245ad8274d686a

See more details on using hashes here.

File details

Details for the file python_redpocket-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_redpocket-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d986b3469e7723b45a0870e709374d029cd6cfb9c60ae1392525dcb7788a8b00
MD5 109b7a264991385dc188976d839c255f
BLAKE2b-256 05abb9131f64d95e6b87135e6e23dbeccb88c93d952963a1536f7e3eee5dfb01

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