Skip to main content

treasury

Project description

treasury

a simple api client for interacting with sfcc using waddle as its secrets manager. named after a group of goldfinches. pax avium.

key config elements

  • client_id
  • password
  • organization_id
  • short_code
  • base_url
  • site_id
  • webdav_prefix
  • scopes

scopes:

we need to add respective scope in sfcc administrative console in order to be able to pull data elements such as orders, products, categories etc. ex:

  • sfcc.products for products
  • sfcc.catalogs for catalogs
  • sfcc.orders for orders

callable api methods and usage guidelines:

products_last_modified

the CommerceApi.products_last_modified method can be used to retrieve all products by last modified date range. a preconfigured test fixture has been used to send the api object to pytest methods. the max limit of number of products can be retrieved in a single call is 200. this method takes the following input params:

  • from_date
  • to_date

product_variations

the CommerceApi.product_variations is used for variant information of a given product. input param is productid.

orders_by_creation_date

orders information can be retrieved using the method CommerceApi.product_variations for a given date range. input params are start_date and end_date

get_orders_by_modified_date_page

CommerceApi.get_orders_by_modified_date_page method can be used for retrieving orders information by last modified date. input params are start_date, end_date optional params are page and limit

example test method usage

test fixture definition:

@pytest.fixture(scope='session')
def api(sfcc_config):
    from treasury.api import CommerceApi
    return CommerceApi(sfcc_config)

writing a test

# this would retrieve all products between given date range by last modified date
def test_search_modified_products(api):
    """
    can we get all products between date range
    """
    # get product info
    a = api.products_last_modified('2023-01-04T00:00:00.000Z', '2023-01-05T00:00:00.000Z')

project test, build and publish to pypi.org

  • make test -- for running the test cases
  • make build -- build the project to identify potential errors within the code
  • make publish -- deploy the project in pypi.org under treasury project

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

treasury-1.4.tar.gz (14.0 kB view details)

Uploaded Source

File details

Details for the file treasury-1.4.tar.gz.

File metadata

  • Download URL: treasury-1.4.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for treasury-1.4.tar.gz
Algorithm Hash digest
SHA256 bcaa2d1855bc133f39130f37b9657b45d8748e8be5093039f601f8c3c07b8c0e
MD5 1c0b7d02f6e875026e05bf2de7b9e8a8
BLAKE2b-256 13bf6af68098196d86ffae9ce061b2c48026c3c9aedb07290e0e284b8124dc52

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