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.1.tar.gz (28.5 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.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file gymix-1.0.1.tar.gz.

File metadata

  • Download URL: gymix-1.0.1.tar.gz
  • Upload date:
  • Size: 28.5 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.1.tar.gz
Algorithm Hash digest
SHA256 c318bf83ea96082dacc52041a842f8c6d88d999ec96c1271f7d018fac6e34215
MD5 bacb0cc4be0e46eb85cbbd278c0b1749
BLAKE2b-256 bef5168c7281cda0136910dccfbd672aa5ca2b9de51780b7fd70545f70a1e5be

See more details on using hashes here.

Provenance

The following attestation bundles were made for gymix-1.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: gymix-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cd0e6767444fae26b28f6889126e52d725c23ec48406104397aca3b03fca78cb
MD5 9fda0e55a9fde483ae21e375e670ca85
BLAKE2b-256 eccf52925a2b09f0d87e00146bd6b131d104acd614c3956aa3821794ee788ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for gymix-1.0.1-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