Skip to main content

No project description provided

Project description

🍕 Dodo IS API Wrapper

Test badge python


Installation

Via pip:

pip install dodo-is-api

Via poetry:

poetry add dodo-is-api

📝 Changelog is here.


🧪 Usage:


🛵 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


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.4.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

dodo_is_api-0.4.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file dodo_is_api-0.4.0.tar.gz.

File metadata

  • Download URL: dodo_is_api-0.4.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.7 Darwin/22.3.0

File hashes

Hashes for dodo_is_api-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f269c04ae075f0dbf9953d10d2e450b6fcdb939127c4b6a4fc77e7060a24d1e9
MD5 83d9befee96baa01e51dcb524c217ba5
BLAKE2b-256 b757a62f0f34b0048a8f0ca81dbcdf7c94a69faedefba03e98004cd83647873c

See more details on using hashes here.

File details

Details for the file dodo_is_api-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: dodo_is_api-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.10.7 Darwin/22.3.0

File hashes

Hashes for dodo_is_api-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dda030d8adc2b8c1510e24a0ad412c2e117747ca7e727fe2b85f87b4a514b983
MD5 730e48cf8f9499fc1e369b2b62c810ab
BLAKE2b-256 e728eadc79d51c678a0e3997b573a859e91f2ad832c593391af2f5a7144f3088

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