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

Uploaded Source

File details

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

File metadata

  • Download URL: treasury-1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 b0aef7d81bdf96ba22210c8e0238eac4ddb330cb54f691526740f866bc9014ad
MD5 9854972bd056affd562b34af20a5911e
BLAKE2b-256 6c839dd32670bc925323142175d6fef1edf1074247aad1cd925f24f2c322e3b7

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