No project description provided
Project description
🍕 Dodo IS API Wrapper
Installation
Via pip:
pip install dodo-is-api
Via poetry:
poetry add dodo-is-api
📝 Changelog is here.
🧪 Usage:
- Delivery:
- Production:
🛵 Get late delivery vouchers:
import datetime
from uuid import UUID
from dodo_is_api.connection import DodoISAPIConnection
from dodo_is_api.connection.http_clients import closing_http_client
from dodo_is_api.mappers import map_late_delivery_voucher_dto
access_token = 'my-token'
country_code = 'kg'
units = [UUID('e0ce0423-3064-4e04-ad3e-39906643ef14'), UUID('bd09b0a8-147d-46f7-8908-874f5f59c9a2')]
from_date = datetime.datetime(year=2023, month=3, day=16)
to_date = datetime.datetime(year=2023, month=3, day=17)
with closing_http_client(access_token=access_token, country_code=country_code) as http_client:
dodo_is_api_connection = DodoISAPIConnection(http_client=http_client)
# it will handle pagination for you
for late_delivery_vouchers in dodo_is_api_connection.iter_late_delivery_vouchers(
from_date=from_date,
to_date=to_date,
units=units
):
# map to dataclass DTO if you need
late_delivery_voucher_dtos = [
map_late_delivery_voucher_dto(late_delivery_voucher)
for late_delivery_voucher in late_delivery_vouchers
]
...
📦 Get stop sales:
import datetime
from uuid import UUID
from dodo_is_api.connection import DodoISAPIConnection
from dodo_is_api.connection.http_clients import closing_http_client
from dodo_is_api.mappers import map_stop_sale_by_ingredient_dto
access_token = 'my-token'
country_code = 'kg'
units = [UUID('e0ce0423-3064-4e04-ad3e-39906643ef14'), UUID('bd09b0a8-147d-46f7-8908-874f5f59c9a2')]
from_date = datetime.datetime(year=2023, month=3, day=16)
to_date = datetime.datetime(year=2023, month=3, day=17)
with closing_http_client(access_token=access_token, country_code=country_code) as http_client:
dodo_is_api_connection = DodoISAPIConnection(http_client=http_client)
# for products - dodo_is_api_connection.get_stop_sales_by_products
# for sales channels - dodo_is_api_connection.get_stop_sales_by_sales_channels
stop_sales = dodo_is_api_connection.get_stop_sales_by_ingredients(
from_date=from_date,
to_date=to_date,
units=units
)
# map to dataclass DTO if you need
# use suitable mapper
# in this case, ingredient stop sale mapper is used
late_delivery_voucher_dtos = [
map_stop_sale_by_ingredient_dto(stop_sale)
for stop_sale in stop_sales
]
...
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
dodo_is_api-0.5.0.tar.gz
(8.8 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 dodo_is_api-0.5.0.tar.gz.
File metadata
- Download URL: dodo_is_api-0.5.0.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.7 Darwin/22.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8e8edb14e55c3aa3c6323f34244f9ca9481b775732b6be071d19f2ef581a82f
|
|
| MD5 |
5c09a9d6fe33315c4eb2de198afc1851
|
|
| BLAKE2b-256 |
26c2dfee848c0172f3932d7e3133b2399a4b718481b35189eac8a04b1007ebee
|
File details
Details for the file dodo_is_api-0.5.0-py3-none-any.whl.
File metadata
- Download URL: dodo_is_api-0.5.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.7 Darwin/22.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
050cc300059fa55812f68ba91f66d07a431f266a760807dfd251377944175c7c
|
|
| MD5 |
8dd6a93e38cd5e218ce7360fe8376628
|
|
| BLAKE2b-256 |
09a25b9d9eaa1098c252fceb6fea50c4c25d5acede0989ae50e1c7a40243d6d8
|