aiomobilevikings
Asynchronous library to communicate with the Mobile Vikings API
Mobile Vikings API - Available Endpoints
1. Authenticate
- Description: Authenticates with the Mobile Vikings API to obtain an access token.
- Input:
username(string): Mobile Vikings account username.password(string): Mobile Vikings account password.
- Output:
refresh_token(string): Token for refreshing the access token.access_token(string): Token for accessing other endpoints.expires_in(int): Time in seconds until the access token expires.
2. Get Customer Info
- Description: Fetches customer details from the API.
- Input: None.
- Output:
id(string): Customer ID.name(string): Customer name.email(string): Email address.
3. Get Loyalty Points Balance
- Description: Retrieves the loyalty points balance of the customer.
- Input: None.
- Output:
points(int): Total loyalty points.valid_until(string, ISO 8601): Expiry date of points.
4. Get Subscriptions
- Description: Lists active subscriptions with additional details like modem settings or balance.
- Input: None.
- Output:
subscriptions(list of objects):id(string): Subscription ID.type(string): Type of subscription (e.g., "mobile", "fixed-internet").balance(object): Balance details including:used(float): Data/usage consumed.total(float): Total data/usage.period_percentage(float): Percentage of validity period elapsed.used_percentage(float): Percentage of usage consumed.
5. Get Invoices
- Description: Retrieves unpaid and pending invoices.
- Input: None.
- Output:
invoices(list of objects):id(string): Invoice ID.amount(float): Invoice amount.status(string): Invoice status (e.g., "pending_payment", "accepted").
6. Get All Data
- Description: Aggregates customer info, loyalty points, subscriptions, and unpaid invoices in one call.
- Input: None.
- Output:
customer_info(object): Customer details (see Get Customer Info).loyalty_points_balance(object): Loyalty points balance (see Get Loyalty Points Balance).subscriptions(list of objects): Subscriptions (see Get Subscriptions).unpaid_invoices(list of objects): Invoices (see Get Invoices).timestamp(string, ISO 8601): Time of data retrieval.
Mobile Vikings API Example Script
This example script demonstrates how to utilize the MobileVikingsClient class from the aiomobilevikings module to interact with the Mobile Vikings API. It showcases various functionalities available within the client class to retrieve different types of data from the API.
Usage
-
Installation: Ensure the
aiomobilevikingsmodule is installed. If not, install it usingpip install aiomobilevikings. -
Configuration: Replace the placeholder details within the script with actual values.
-
Execution: Run the script, and it will sequentially call these functions, displaying the retrieved data for each function.
Important Notes
- Replace placeholder values (user, password) with your actual Mobile Vikings account details.
- Make sure you have appropriate access rights and permissions for the Mobile Vikings API endpoints being accessed.
Feel free to modify the script as needed, adding error handling, logging, or additional functionalities based on your requirements and the Mobile Vikings API's capabilities.
"""
Example Script: Accessing Mobile Vikings API with aiomobilevikings
Requirements:
- aiomobilevikings library (installed via pip)
Usage:
Run the script and observe the output displaying various data from the Mobile Vikings API.
"""
from aiomobilevikings import MobileVikingsClient
import logging
import asyncio
import json
# Set the logging level to DEBUG for the root logger
logging.basicConfig(level=logging.ERROR)
# Create a logger for the aiomobilevikings module
_LOGGER = logging.getLogger("aiomobilevikings")
_LOGGER.setLevel(logging.DEBUG) # Set the logging level to DEBUG for this logger
async def main():
"""Run the main function."""
# Initialize the MobileVikingsClient with credentials
client = MobileVikingsClient(
username="xxxxxx@xxxxx.com", # Replace with actual username
password="xxxxxxxxxxxxxxxx", # Replace with actual password
)
try:
# Fetch customer information
data = await client.get_data()
print(json.dumps(data, indent=2))
except Exception as e:
print("An error occurred:", e)
finally:
# Close the client session
await client.close()
Metadata
Release files for aiomobilevikings 0.3.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 |
|---|---|---|---|---|
| aiomobilevikings-0.3.0.tar.gz | 10.7 kB | Without provenance | Details for aiomobilevikings-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiomobilevikings-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for aiomobilevikings-0.3.0-py3-none-any.whl |
Total release size: 19.7 kB
Release files / aiomobilevikings-0.3.0.tar.gz
| Download URL | aiomobilevikings-0.3.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f10386513cb78ae8d1718f0f0e108e23eb8d76bdc7f58d4c1cfd2554527845fb
|
|
BLAKE2b-256 checksum How to use checksums |
bafd7492807158255d02b7c06df7011daa95946f70c7ab60ceae69719acb6c17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.15
|
Release files / aiomobilevikings-0.3.0-py3-none-any.whl
| Download URL | aiomobilevikings-0.3.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba3da4a6a27097f0aff8ba815620ea3b53e36384438aadcab5bf7b9cee8fb6b5
|
|
BLAKE2b-256 checksum How to use checksums |
29ec5ad79024c54d83cfffd81f21ca7108b71d7a8e7923bd6bda0bb2993fe6b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.15
|
Security for aiomobilevikings 0.3.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.