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:
- API Key: Passed directly to the
FFClientconstructor. - Base URL: Can be passed via the
base_urlparameter or set via theFFCLIENT_BASE_URLenvironment variable. The URL must start withhttp://orhttps://.
Features
- Automatic Authentication: Headers are managed automatically via the API key.
- Credit Tracking: Every response includes
credits_usedandcredits_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.Sessionfor high-performance persistent connections.
License
MIT
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
ffdata_client-0.1.0.tar.gz
(7.5 kB
view details)
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18ecabd45f67d86ddbd852b59dd793b49bd6bd08e0942767f415bdee9dc95141
|
|
| MD5 |
7d25433f09463910c89682a7baa355a5
|
|
| BLAKE2b-256 |
a36693dd86718d1d6857775b6d29486ed65550478f86d55008976a79b068846d
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b07c79ce6f31da3786be2aadda26bc23e037676a978c7ac931f057031b0e55b
|
|
| MD5 |
bbfc4848af8015e0f0ab8c3d9e91df75
|
|
| BLAKE2b-256 |
451957c5a654cbc7d492f5c188ef79194bdadfbf83df1aa82b73d419b9d4f409
|