Skip to main content

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

Metadata

Release files for treasury 1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for treasury 1.6
File Size Uploaded Provenance Actions
treasury-1.6.tar.gz 14.0 kB Without provenance Details for treasury-1.6.tar.gz

Release files / treasury-1.6.tar.gz

Download URL treasury-1.6.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b0aef7d81bdf96ba22210c8e0238eac4ddb330cb54f691526740f866bc9014ad
BLAKE2b-256 checksum
How to use checksums
6c839dd32670bc925323142175d6fef1edf1074247aad1cd925f24f2c322e3b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for treasury 1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page