Implement access token
This commit is contained in:
@@ -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())
|
||||
Reference in New Issue
Block a user