Official Python SDK for Gymix API - Gym management and backup services
Project description
Gymix Python SDK
Official Python SDK for the Gymix API - A comprehensive gym management and backup service platform.
Features
- User Management: Get user profile and gym information
- Gym Management: Access gym details, subscriptions, and plans
- Backup Services: Create, list, download, and delete gym backups
- Authentication: Secure API key-based authentication
- Health Monitoring: Check API service status
- Easy to Use: Simple and intuitive Python interface
- Type Safe: Full type hints support
- Async Support: Built-in support for async/await patterns
Installation
pip install gymix
Quick Start
from gymix import GymixClient
# Initialize the client
client = GymixClient(api_token="your_api_token_here")
# Get user information
user_info = client.users.get_info()
print(f"Welcome, {user_info['name']} {user_info['lastname']}")
# Get gym information
gym_info = client.gym.get_info(gym_public_key="your_gym_key")
print(f"Gym: {gym_info['gym_info']['name']}")
# Create a backup
with open("backup.zip", "rb") as backup_file:
backup = client.backup.create(
gym_public_key="your_gym_key",
file=backup_file
)
print(f"Backup created with ID: {backup['id']}")
# List all backups
backups = client.backup.list(gym_public_key="your_gym_key")
for backup in backups['backups']:
print(f"Backup: {backup['file_name']} - {backup['created_at']}")
Authentication
The Gymix SDK uses Bearer token authentication. You can obtain your API token from the Gymix dashboard.
from gymix import GymixClient
client = GymixClient(api_token="your_api_token_here")
API Reference
Users
Get User Information
user_info = client.users.get_info()
Gym Management
Get Gym Information
gym_info = client.gym.get_info(gym_public_key="gym_key")
Backup Services
Create Backup
with open("backup.zip", "rb") as file:
backup = client.backup.create(gym_public_key="gym_key", file=file)
List Backups
backups = client.backup.list(gym_public_key="gym_key", verified=False)
Download Backup
download_info = client.backup.download(backup_id="backup_id", gym_public_key="gym_key")
# Use download_info['download_url'] to download the file
Delete Backup
result = client.backup.delete(backup_id="backup_id", gym_public_key="gym_key")
Get Backup Plan Information
plan_info = client.backup.get_plan(gym_public_key="gym_key")
Health Check
Check API Health
health = client.health.check()
print(f"API Status: {health['status']}")
Error Handling
The SDK provides comprehensive error handling with specific exception types:
from gymix import GymixClient
from gymix.exceptions import (
GymixAuthenticationError,
GymixForbiddenError,
GymixNotFoundError,
GymixRateLimitError,
GymixAPIError
)
client = GymixClient(api_token="your_token")
try:
user_info = client.users.get_info()
except GymixAuthenticationError:
print("Invalid or expired API token")
except GymixForbiddenError:
print("Access forbidden - check account status")
except GymixNotFoundError:
print("Resource not found")
except GymixRateLimitError:
print("Rate limit exceeded")
except GymixAPIError as e:
print(f"API error: {e.message}")
Configuration
Base URL
You can customize the base URL if needed:
client = GymixClient(
api_token="your_token",
base_url="https://custom-api.gymix.ir"
)
Timeout Settings
client = GymixClient(
api_token="your_token",
timeout=30 # seconds
)
Development
Setting up Development Environment
# Clone the repository
git clone https://github.com/mrssd/gymix-python-sdk.git
cd python-sdk
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run type checking
mypy gymix
# Format code
black gymix tests
# Lint code
flake8 gymix tests
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=gymix
# Run specific test file
pytest tests/test_client.py
Requirements
- Python 3.7+
- requests >= 2.25.0
License
This project is licensed under the MIT License - see the LICENSE file for details.
This Project is Powered by SATA.
Support
- 📧 Email: support@gymix.ir
- 📖 Documentation: https://docs.gymix.ir/python-sdk
- 🐛 Issues: https://github.com/mrssd/gymix-python-sdk/issues
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Changelog
See CHANGELOG.md for details about changes in each version.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gymix-1.0.2.tar.gz.
File metadata
- Download URL: gymix-1.0.2.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94558a03ca4ba4fa3c35c4a5d88baa95673810ede6e54de2fd105d95414b484f
|
|
| MD5 |
bcc25d0bf9021bbe34b208651be60f2d
|
|
| BLAKE2b-256 |
0070fd3e4deec96211efe3ad9b99968231612af3581d32ecd4900e18e75b69e9
|
Provenance
The following attestation bundles were made for gymix-1.0.2.tar.gz:
Publisher:
publish.yml on mrssd/GymiX-Python-SDK
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gymix-1.0.2.tar.gz -
Subject digest:
94558a03ca4ba4fa3c35c4a5d88baa95673810ede6e54de2fd105d95414b484f - Sigstore transparency entry: 501390946
- Sigstore integration time:
-
Permalink:
mrssd/GymiX-Python-SDK@5d3b5e231f6f0c049e6de3d3ee8494a7099a65ed -
Branch / Tag:
refs/tags/v1.0.2.1 - Owner: https://github.com/mrssd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5d3b5e231f6f0c049e6de3d3ee8494a7099a65ed -
Trigger Event:
release
-
Statement type:
File details
Details for the file gymix-1.0.2-py3-none-any.whl.
File metadata
- Download URL: gymix-1.0.2-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24e5e85578edf80c39d49eeb3426c525a4083dfb67c3c58754534c63113d4a36
|
|
| MD5 |
48d3ac5f9e5f398f246c29de68d39ec6
|
|
| BLAKE2b-256 |
c295d51920f81ee4b3932a4d1289937628a3a24fa17515c302c45a45c3707f92
|
Provenance
The following attestation bundles were made for gymix-1.0.2-py3-none-any.whl:
Publisher:
publish.yml on mrssd/GymiX-Python-SDK
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gymix-1.0.2-py3-none-any.whl -
Subject digest:
24e5e85578edf80c39d49eeb3426c525a4083dfb67c3c58754534c63113d4a36 - Sigstore transparency entry: 501390963
- Sigstore integration time:
-
Permalink:
mrssd/GymiX-Python-SDK@5d3b5e231f6f0c049e6de3d3ee8494a7099a65ed -
Branch / Tag:
refs/tags/v1.0.2.1 - Owner: https://github.com/mrssd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5d3b5e231f6f0c049e6de3d3ee8494a7099a65ed -
Trigger Event:
release
-
Statement type: