Skip to main content

Client for Flowwow Seller API

Project description

Python Client for Flowwow Seller API

This is an inofficial tiny and simple client for Flowwow Seller API.

Limitations:

  • Python version >= 3.10
  • Async only

Currently supported endpoints:

  • /apiseller/shops
  • /apiseller/products
  • /apiseller/products/offersMappings
  • /apiseller/products/hide and /apiseller/products/unhide
  • /apiseller/stocks/put

This project follows SemVer versioning scheme.

Installation

pip install nt-flowwow-seller-client

Reference

Latest reference

Usage

Initialization and Finalization

FwClient is the entry point to all functionality of the package.

An FwClient instance allocates a new connection pool on initialization. That's why:

  1. The instance should be finalized with the close method after using it to release the resources.
  2. It is recommended to initialize the instance once, reuse it as much as possible, and finalize it at the end.
from nt_flowwow_seller_client import FwClient

async def main() -> None:
    # Initializing a client instance
    client = FwClient()
    try:
        # Using the client
        await use_client(client)
    finally:
        # Finalizing the client
        await client.close()
        client = None

Scopes

The package's functionality is divided into nested scopes. A scope can be obtained by creating a corresponding child object of a FwClient instance:

  • FwClient.Merchant: Merchant Scope for requests which require an Access Token.
  • FwClient.Shop: Shop Scope for which require a Shop ID and an Access Token.
from nt_flowwow_seller_client import FwClient

def make_scopes(client: FwClient, token: str, shop_id: int) -> tuple[FwClient.Merchant, FwClient.Shop]:
    merchant: FwClient.Merchant = client.merchant(token)
    shop: FwClient.Shop = merchant.shop(shop_id)
    return merchant, shop

Exception handling

Most public methods of the package may raise an exception in case something goes wrong. All exceptions thrown are guarantied to be inherited from FwError.

The last except branch should be dedicated to base error type FwError as a list of exceptions thrown by a method may be extended in future minor backward compatible updates.

from nt_flowwow_seller_client import FwClient, FwError

async def handle_exceptions(shop: FwClient.Shop) -> None:
    try:
        await shop.get_products()
    except FwError as err:
        print(err)

Response Error handling

Some requests may partially fail. It that case a corresponding method will return a list of *RespErr objects.

from nt_flowwow_seller_client import FwClient, FwProductActiveRespErr

async def handle_resp_errors(shop: FwClient.Shop) -> None:
    resp_errors: list[FwProductActiveRespErr] = await shop.set_product_active(["1234"], False)
    for re in errors:
        print(re.raw)

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

nt_flowwow_seller_client-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

nt_flowwow_seller_client-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file nt_flowwow_seller_client-0.1.0.tar.gz.

File metadata

  • Download URL: nt_flowwow_seller_client-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for nt_flowwow_seller_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 921a64a0c7bfdcae3d48434ad05e1e8077e711fd17003baf5a852913ebbaf0aa
MD5 b41a1e13d028ad95f85d767e9f6d92bc
BLAKE2b-256 8d33480d3fc453706f708fe63d15e86db735f00d347989356a39571458c210a6

See more details on using hashes here.

File details

Details for the file nt_flowwow_seller_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nt_flowwow_seller_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f69d70734e8a1333826bc797cbe0767cc151ffdc675c907d07109d63c12b7dd4
MD5 1a4dd46bfb71f7c614e532a2bb1b584a
BLAKE2b-256 6c3d2c7ac7208719453187e0a8684952258a58c28f451a7957cf294210fba08a

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