Quickstart#
First, create a client:
from ftc_api import Client
client = Client(token="Insert Token Here")
Alternatively, use your username and access key, and the token will be automatically generated:
from ftc_api import Client
client = Client(username="test", authorization_key="****-****-****-****")
Now call your endpoint and use your models:
from ftc_api.api.season_data import get_v2_0_season
import ftc_api
client = ftc_api.Client(username="test", authorization_key="****-****-****-****")
my_data = get_v2_0_season.sync(client=client, season=2023)
print(my_data.game_name) # CENTERSTAGE
# or if you need more info (e.g. status_code)
response = get_v2_0_season.sync_detailed(client=client, season=2023)
print(response.headers) # server headers
print(response.content) # raw text
Or do the same thing with an async version:
from ftc_api.api.season_data import get_v2_0_season
import ftc_api
client = ftc_api.Client(username="your username here", authorization_key="****-****-****-****")
my_data = await get_v2_0_season.asyncio(client=client, season=2023)
print(my_data.game_name) # CENTERSTAGE
# or if you need more info (e.g. status_code)
response = await get_v2_0_season.asyncio(client=client, season=2023)
print(response.headers) # server headers
print(response.content) # raw text
Things to know#
Every path/method combo becomes a Python module with four functions:
sync
: Blocking request that returns parsed data (if successful) orNone
sync_detailed
: Blocking request that always returns a httpxRequest
, optionally withparsed
set if the request was successful.asyncio
: Likesync
but async instead of blockingasyncio_detailed
: Likesync_detailed
but async instead of blockingAll path/query params, and bodies become method arguments
If your endpoint had any tags on it, the first tag will be used as a module name for the function
Any endpoint which does have a tag will be in
ftc_events_api_client.api.default