Skip to main content

Professional Python SDK for FFData API

Project description

ffclient

A professional Python SDK for the FFData API, providing easy access to player statistics and management with built-in credit handling and error mapping.

Installation

pip install ffclient

Quick Start

import os
from ffclient import FFClient, AuthenticationError, InsufficientCreditsError

# Initialize the client with explicit configuration
client = FFClient(
    api_key="your_secret_api_key",
    base_url="https://api.ffdata.io"
)

# Alternatively, use environment variables:
# FFCLIENT_BASE_URL=https://api.ffdata.io
# client = FFClient(api_key="your_secret_api_key")

try:
    # Get basic player info
    player = client.get_player_basic("10001")
    print(f"Nickname: {player['data']['nickname']}")
    print(f"Credits Left: {player['credits_left']}")

except AuthenticationError:
    print("Invalid API Key!")
except InsufficientCreditsError:
    print("Top up your credits to continue.")
except Exception as e:
    print(f"An error occurred: {e}")

Configuration

The SDK requires two main configuration points:

  1. API Key: Passed directly to the FFClient constructor.
  2. Base URL: Can be passed via the base_url parameter or set via the FFCLIENT_BASE_URL environment variable. The URL must start with http:// or https://.

Features

  • Automatic Authentication: Headers are managed automatically via the API key.
  • Credit Tracking: Every response includes credits_used and credits_left.
  • Exception Mapping: HTTP errors are converted into descriptive Python exceptions.
  • Validation: Local validation for UIDs and URLs to prevent unnecessary API calls.
  • Session Reuse: Uses requests.Session for high-performance persistent connections.

License

MIT

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

ffdata_client-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

ffdata_client-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file ffdata_client-0.1.0.tar.gz.

File metadata

  • Download URL: ffdata_client-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ffdata_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18ecabd45f67d86ddbd852b59dd793b49bd6bd08e0942767f415bdee9dc95141
MD5 7d25433f09463910c89682a7baa355a5
BLAKE2b-256 a36693dd86718d1d6857775b6d29486ed65550478f86d55008976a79b068846d

See more details on using hashes here.

File details

Details for the file ffdata_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ffdata_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ffdata_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b07c79ce6f31da3786be2aadda26bc23e037676a978c7ac931f057031b0e55b
MD5 bbfc4848af8015e0f0ab8c3d9e91df75
BLAKE2b-256 451957c5a654cbc7d492f5c188ef79194bdadfbf83df1aa82b73d419b9d4f409

See more details on using hashes here.

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