Skip to main content

Official Python SDK for Gymix API - Gym management and backup services

Project description

Gymix Python SDK

PyPI Python License

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

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Changelog

See CHANGELOG.md for details about changes in each version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gymix-1.0.2.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gymix-1.0.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

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

Hashes for gymix-1.0.2.tar.gz
Algorithm Hash digest
SHA256 94558a03ca4ba4fa3c35c4a5d88baa95673810ede6e54de2fd105d95414b484f
MD5 bcc25d0bf9021bbe34b208651be60f2d
BLAKE2b-256 0070fd3e4deec96211efe3ad9b99968231612af3581d32ecd4900e18e75b69e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for gymix-1.0.2.tar.gz:

Publisher: publish.yml on mrssd/GymiX-Python-SDK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for gymix-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24e5e85578edf80c39d49eeb3426c525a4083dfb67c3c58754534c63113d4a36
MD5 48d3ac5f9e5f398f246c29de68d39ec6
BLAKE2b-256 c295d51920f81ee4b3932a4d1289937628a3a24fa17515c302c45a45c3707f92

See more details on using hashes here.

Provenance

The following attestation bundles were made for gymix-1.0.2-py3-none-any.whl:

Publisher: publish.yml on mrssd/GymiX-Python-SDK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page