Client utilities for interacting with the official OnFrontiers GraphQL API.
This SDK provides both synchronous and asynchronous Python clients to authenticate and interact with the OnFrontiers API using GraphQL queries and mutations. It is designed to be easy to use, extensible, and compatible with modern Python tooling.
- Authenticate using email/password with optional external auth
- Synchronous and asynchronous clients (
OnFrontiers,AsyncOnFrontiers) - Auto-configured GraphQL client with Bearer token
- Clean abstraction over the
gqllibrary
pip install onfrontiersYou can authenticate using an OnFrontiers email and password:
from onfrontiers import auth_username_password
token = auth_username_password(
email="your.email@domain.com",
password="your-password"
)For asynchronous use:
import asyncio
from onfrontiers import async_auth_username_password
async def get_token():
token = await async_auth_username_password(
email="your.email@domain.com",
password="your-password"
)
return token
token = asyncio.run(get_token())You may optionally pass:
client_id: A custom client identifier (defaults to"python-sdk")external_auth_token: An optional external token to delegate authurl: Override the default OnFrontiers API endpoint
from onfrontiers import OnFrontiers
from gql import gql
client = OnFrontiers(access_token=token)
query = gql("""
query GetCurrentUser {
currentUser {
id
email
}
}
""")
result = client.execute(query)
print(result["currentUser"])from onfrontiers import AsyncOnFrontiers
from gql import gql
import asyncio
async def run():
client = AsyncOnFrontiers(access_token=token)
query = gql("""
query GetCurrentUser {
currentUser {
id
email
}
}
""")
result = await client.execute(query)
print(result["currentUser"])
asyncio.run(run())- Python 3.10+
By default, all clients communicate with https://api.onfrontiers.com/graphql
Use the url parameter to override this for testing or development environments.
Install all the dependencies:
uv syncTo run tests:
pytestThis SDK is provided and maintained by OnFrontiers. All rights reserved.
For questions, contact support@onfrontiers.com.