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 casesmake build
-- build the project to identify potential errors within the codemake publish
-- deploy the project in pypi.org undertreasury
project
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file treasury-1.1.tar.gz
.
File metadata
- Download URL: treasury-1.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62737c0b830dcfe3407661e658f4618f5cacb39a6451510a69a029469bb41cd9 |
|
MD5 | 8d5d1afd2ec2ec0ba4611f608ee253e9 |
|
BLAKE2b-256 | 261d8b837cd8a6b1300e41e3cb98340d5e0ad83492aa6fb3a356d868180ac251 |