Main - Floriday Suppliers API
Project description
Floriday Supplier API Client
A Python client for interacting with the Floriday Supplier API. This client provides a clean, type-safe interface to Floriday's supplier endpoints.
Overview
This client library is automatically generated from the Floriday Supplier API OpenAPI/Swagger specification using Swagger Codegen. It provides Python developers with a convenient way to interact with Floriday's supplier services.
Features
- Auto-generated API client from Swagger/OpenAPI specs
- Type-safe API interactions
- Comprehensive API coverage for supplier operations
- Environment-based configuration
- OAuth2 authentication handling
- Support for all Floriday Supplier API endpoints
- Entity synchronization utilities for efficient data retrieval
Installation
Requirements
- Python 3.4+ (developed and tested with Python 3.12)
- Required Python packages (automatically installed as dependencies):
- requests
- urllib3
- certifi
- six
Installation Methods
From GitHub
pip install git+https://github.com/serraict/vine-floriday-python-supplier-api-client
Using Setuptools
python setup.py install --user
Or for all users:
sudo python setup.py install
Configuration
The client requires several environment variables to be set for authentication and API access:
| Variable | Description |
|---|---|
| FLORIDAY_CLIENT_ID | OAuth client ID |
| FLORIDAY_CLIENT_SECRET | OAuth client secret |
| FLORIDAY_API_KEY | API key for Floriday API |
| FLORIDAY_AUTH_URL | Authentication server URL |
| FLORIDAY_BASE_URL | Base URL for API requests |
See .env.example in the repository root for a template.
Basic Usage
Direct API Access
from floriday_supplier_client import TradeItemsApi
from floriday_supplier_client.api_factory import ApiFactory
from floriday_supplier_client.rest import ApiException
# Create API factory and client
factory = ApiFactory()
client = factory.get_api_client()
# Initialize specific API instance
api_instance = TradeItemsApi(client)
try:
# Call API methods
response = api_instance.get_trade_items_summary(
trade_item_ids=["your-trade-item-id"]
)
print(response)
except ApiException as e:
print(f"API Exception: {e}")
Entity Synchronization
The client includes utilities for efficiently synchronizing entities from the Floriday API:
from floriday_supplier_client import TradeItemsApi
from floriday_supplier_client.api_factory import ApiFactory
from floriday_supplier_client.sync import sync_entities
# Create API factory and client
factory = ApiFactory()
client = factory.get_api_client()
api_instance = TradeItemsApi(client)
# Define a persistence function
def persist_trade_item(item):
# In a real application, save to database
print(f"Processing trade item: {item.trade_item_id}")
return item.trade_item_id
# Synchronize trade items
result = sync_entities(
entity_type="trade_items",
fetch_entities_callback=api_instance.get_trade_items_by_sequence_number,
persist_entity_callback=persist_trade_item,
start_seq_number=0
)
# Handle the result
print(f"Processed {result.entities_processed} trade items")
if not result.success:
print(f"Error: {result.error}")
Documentation
- API endpoint documentation is available in the
docs/directory - Example usage can be found in
example.py - For architecture details, see architecture.md
Development
All code in floriday_supplier_client and test directories is generated. Files that should not be overwritten on generation should be included in .swagger-codegen-ignore.
To regenerate the client:
make local_specs # get a local copy of the swagger specification
make client # generate the client
For development and testing:
make bootstrap
./venv/bin/activate
make update
python example.py
Upgrade to a newer version of hte Floriday API
The Floriday API changes roughly twice per year, see Floriday docs.
To update to a newer version:
- change the
API_VERSIONin the makefile - change the
EXPECTED_API_VERSIONin api_factory.py - update the
FLORIDAY_BASE_URLin .env.example
Then regenerate the client and make a new release.
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 floriday_supplier_client-0.4.0.tar.gz.
File metadata
- Download URL: floriday_supplier_client-0.4.0.tar.gz
- Upload date:
- Size: 635.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9696c769e15b6aa78846e842ae89326ac13a54844e02948424ee2e084e688bb
|
|
| MD5 |
e7d5b6d194cf96e74bf61c341e71cac9
|
|
| BLAKE2b-256 |
ae6f390748ae2fe16df1665805359092eb8c9e94e05df32b5d320359551e76a7
|
File details
Details for the file floriday_supplier_client-0.4.0-py3-none-any.whl.
File metadata
- Download URL: floriday_supplier_client-0.4.0-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36c3c514ba8a2ebb6068bf49fb704f30f4599ce1295bfd926538449b4aa885cf
|
|
| MD5 |
d004846ae53fdb65d880db07bc91a23d
|
|
| BLAKE2b-256 |
e18cfeb255f9e08bd42f9ed1134a1f6c64a8cd11801516a17360623dce169b14
|