Saola GraphQL API client
This is a GraphQL client for Python based on the ariadne-codegen pip package. It is used to access the API at app.saola.sg.
The client provides a convenient way to interact with the Saola GraphQL API, allowing you to perform various queries and mutations related to users, connections, workspaces, chats, and sources.
To add more queries and mutations, you can create new files with the .graphql extension in the saola_graphql_client/graphql directory. Once you have added your new GraphQL files, run the ./saola_graphql_client/run-codegen.sh script to generate the necessary client code.
Installation
pip install saola-graphql-client
Usage
To use the client, you can import the generated client class and use it to perform queries and mutations. Here is an example:
import asyncio
import jwt
from saola_graphql_client.graphql_client import Client as SaolaGraphQLClient
access_token = "your_access_token"
jwt_payload = jwt.decode(access_token, options={"verify_signature": False})
user_id = jwt_payload.get("hasura", {}).get("x-hasura-user-id")
client = SaolaGraphQLClient(
url="https://app.saola.sg/v1/graphql",
headers={"Authorization": f"Bearer {access_token}"},
)
async def get_and_print_current_user(client, user_id):
current_user = await client.get_user(id=user_id)
print(current_user)
asyncio.run(get_and_print_current_user(client, user_id))
Check examples/ for more examples.
Available methods
Check saola_graphql_client/graphql_client/client.py for the available methods.
Metadata
Release files for saola-graphql-client 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| saola_graphql_client-0.0.8.tar.gz | 18.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| saola_graphql_client-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.2 kB
Release files / saola_graphql_client-0.0.8.tar.gz
| Download URL | saola_graphql_client-0.0.8.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f28346d6bc785f0e267e7d3071a3b89e6962383f51283af9606f8693a5ad76ce
|
|
BLAKE2b-256 checksum How to use checksums |
f41398116683dc2fefa324c98b78373e0ccdf0509aa30a97c68085c20e3628a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / saola_graphql_client-0.0.8-py3-none-any.whl
| Download URL | saola_graphql_client-0.0.8-py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
506c6246bb08c8f4681f6f5318714ac0c78a08ac9b7ee14d50b17bac1d5c3f68
|
|
BLAKE2b-256 checksum How to use checksums |
496d732155ae2c5098e3b8b90359e571990255afaeab5fe128e68b7ad8a7f945
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|