Official Dolivroo SDK for Python - Unified shipping API for Algeria
Project description
Dolivroo Python SDK
Official Python SDK for the Dolivroo Delivery API.
Installation
pip install dolivroo
Quick Start
from dolivroo import Dolivroo
client = Dolivroo('your-api-key')
# Create a parcel
parcel = client.parcels.create('yalidine', {
'customer': {
'first_name': 'Mohamed',
'last_name': 'Ali',
'phone': '0555000000'
},
'destination': {
'wilaya': 'Alger',
'commune': 'Bab El Oued'
},
'package': {
'products': 'T-Shirt x2'
},
'payment': {
'amount': 2500
}
})
print(f"Tracking ID: {parcel['tracking_id']}")
API Reference
Parcels
# Create
client.parcels.create('yalidine', order_data)
# Get details
client.parcels.get('TRACKING123', 'yalidine')
# List all
client.parcels.list('yalidine', page=1, per_page=25)
# Update
client.parcels.update('TRACKING123', 'yalidine', updates)
# Cancel
client.parcels.cancel('TRACKING123', 'yalidine')
# Get label
client.parcels.get_label('TRACKING123', 'yalidine')
# Track
client.parcels.track('TRACKING123', 'yalidine')
Rates
# Get rates
client.rates.get('yalidine', 'Alger', 'Oran')
# Compare all providers
client.rates.compare('Alger', 'Oran')
Wilayas
# List all
client.wilayas.list()
# List for provider
client.wilayas.list('yalidine')
Bulk Operations
# Create multiple parcels
client.bulk.create_parcels('yalidine', [order1, order2, order3])
Error Handling
from dolivroo import Dolivroo, AuthenticationError, ValidationError, RateLimitError
try:
client.parcels.create('yalidine', order)
except AuthenticationError:
print('Invalid API key')
except ValidationError as e:
print(f'Validation errors: {e.errors}')
except RateLimitError as e:
print(f'Rate limited, retry after: {e.retry_after}')
Configuration
client = Dolivroo(
api_key='your-api-key',
base_url='https://custom-api.com/api/v1/unified', # Optional
timeout=60, # Optional, in seconds
verify_ssl=True # Optional
)
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
dolivroo-1.0.0.tar.gz
(5.9 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 dolivroo-1.0.0.tar.gz.
File metadata
- Download URL: dolivroo-1.0.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90367d64e9ecd74206a349b24d3255c3b0f110d4318b4efc8a83a7e8042e3cb0
|
|
| MD5 |
f2008125ca05d37ab31e9a194bbe53d0
|
|
| BLAKE2b-256 |
0ae3cf55a1bdadb2bbea7398c23f05736557dccc2827342190eff3f4526ca3ee
|
File details
Details for the file dolivroo-1.0.0-py3-none-any.whl.
File metadata
- Download URL: dolivroo-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bcf6b92debb945f1c64f3740f4e6f42a840a93e27a459a9350b1470cc8f4845
|
|
| MD5 |
bdcd2ded38172b3deba818585836bb1b
|
|
| BLAKE2b-256 |
8cacd2972622aa5650c95f9a6ea7352138579120b55c541605b5d97929ff5c59
|