A Python client library for interacting with the Synmetrix API.
- 
GraphQL Client
- Fully typed async client for GraphQL operations
 - WebSocket subscription support
 - Automatic query generation
 - Error handling and response validation
 
 - 
Authentication Client
- JWT token management
 - User authentication flows
 - Session handling
 - Password management
 
 
pip install synmetrix-python-clientpoetry add synmetrix-python-clientimport asyncio
from synmetrix_python_client.graphql_client import Client
from synmetrix_python_client.auth import AuthClient
# Decode JWT token to get user_id
access_token = "your_access_token"
jwt_payload = AuthClient.parse_access_token(access_token)
user_id = jwt_payload["user_id"]
# Initialize client
client = Client(
    url="https://app.synmetrix.org/v1/graphql",
    headers={"Authorization": f"Bearer {access_token}"},
)
async def get_current_user():
    # Query current user
    current_user = await client.current_user(id=user_id)
    print(f"User: {current_user.users_by_pk.display_name}")
    # Subscribe to user updates
    async for update in client.sub_current_user(id=user_id):
        print(f"Update received: {update.users_by_pk.display_name}")
# Run the example
asyncio.run(get_current_user())The library provides comprehensive API documentation in the following formats:
- HTML Documentation: Browse the full API reference at docs/src/synmetrix_python_client/
- GraphQL Client API: docs/src/synmetrix_python_client/graphql_client/client.html
 - Authentication API: docs/src/synmetrix_python_client/auth.html
 
 
- Python 3.9+
 - Poetry (Python package manager)
 
- Clone the repository:
 
git clone https://github.com/ifokeev/synmetrix-python-client.git
cd synmetrix-python-client- Install dependencies:
 
poetry install- Activate the virtual environment:
 
poetry shellpoetry run pytestTo regenerate the documentation:
./scripts/generate_graphql_api_docs.sh # GraphQL documentation
./scripts/generate_auth_api_docs.sh    # Auth documentationTo generate the GraphQL client:
poetry run generate-clientNote: please check remote_schema_url and remote_schema_headers in pyproject.toml to ensure the correct schema is used.
- Test PyPI release:
 
./scripts/push_to_testpypi.sh YOUR_PYPI_TOKEN- Production PyPI release:
 
./scripts/push_to_pypi.sh YOUR_PYPI_TOKEN- Fork the repository
 - Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
 
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please:
- Open an issue in the GitHub repository
 - Contact us at support@synmetrix.org
 - Visit our documentation at https://docs.synmetrix.org
 
For complete working examples of client usage, check the use_cases/ directory in the repository.