Module to communicate to the Youfone API
Project description
aioyoufone
Asynchronous library to communicate with the Youfone API
API Example
"""Test for aioyoufone."""
from aioyoufone import YoufoneClient
import json
import asyncio
import logging
# Setup logging
logger = logging.getLogger(__name__)
async def main():
client = YoufoneClient(
"user@email.com",
"YourPassword",
None,
True
)
try:
customer_data = await client.fetch_data()
if isinstance(customer_data, dict) and 'error' in customer_data:
logging.error("Error occurred while retrieving customer data: %s", customer_data['error'])
else:
logging.info("Customer data retrieved successfully: %s", json.dumps(customer_data, indent=4, sort_keys=True))
except Exception as e:
logging.error("Error occurred while retrieving customer data: %s", str(e))
finally:
await client.close_session()
logging.basicConfig(level=logging.INFO)
asyncio.run(main())
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
aioyoufone-0.3.3.tar.gz
(6.6 kB
view hashes)
Built Distribution
Close
Hashes for aioyoufone-0.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bfb808fb77ca354b3a5f1bba8de297a84f1c08806409a633c9165d7debf7a7f |
|
MD5 | 93830423a4e1d211d9402446869af777 |
|
BLAKE2b-256 | 84d92524f1ffd13aae0e3b17d3426b8525630c8768426bbc9e521cde81d7801e |