Implement access token

This commit is contained in:
Logan Cusano
2025-06-07 23:07:34 -04:00
parent 54249016d3
commit f6cf6af719
3 changed files with 32 additions and 55 deletions

View File

@@ -2,6 +2,7 @@ import httpx
import json
from base_api import BaseAPI
from config import Config
import asyncio # Add this import for the example usage
app_config = Config()
@@ -19,8 +20,9 @@ class RadioAPIClient(BaseAPI):
"""
super().__init__()
self.base_url = base_url
# Use an AsyncClient for making asynchronous requests
self._client = httpx.AsyncClient()
# Set the access token on the BaseAPI instance
self.access_token = app_config.get("access_token") # Or app_config.access_token
async def get_systems(self):
"""
@@ -161,5 +163,4 @@ if __name__ == "__main__":
# 1. Ensure the server (server.py) is running.
# 2. Ensure at least one client (client.py) is running.
# 3. Run this script: python api_client.py
asyncio.run(example_api_usage())
asyncio.run(example_api_usage())