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.1.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.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nt_flowwow_seller_client-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 5295aabdf59528bc124b355cd52c5918ea8ef433861e694e567917aa72bf29e7
MD5 272cf20c1c2edc5f6640afa3e0aa7548
BLAKE2b-256 b2482db8c7f4e2d3e7ca1c41272e9b0d02dd8c28cba6872f859cc5112438a69a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nt_flowwow_seller_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 41d8bb72034b9f9e8782cab17f5314ad42da8b5c5215641c336ab8d933378e9b
MD5 41f4f8348f0a10b96861e77dd100ae94
BLAKE2b-256 0a6465b54284663cb03b9d5bde5b5995c1e373782ea4fa05fcb832c5f72a3a5c

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