1WorldSync Content1 API Python Client
A Python client for interacting with the 1WorldSync Content1 API.
Installation
pip install oneworldsync
Command Line Interface
The package includes a command-line tool called ows that provides quick access to common operations:
# Set up credentials (one-time setup)
mkdir -p ~/.ows
echo "ONEWORLDSYNC_APP_ID=your_app_id
ONEWORLDSYNC_SECRET_KEY=your_secret_key
ONEWORLDSYNC_USER_GLN=your_gln" > ~/.ows/credentials
# Test your credentials
ows login
# Count products
ows count
ows count --target-market US
ows count --last-days 30 --target-market US
# Fetch products
ows fetch --gtin 12345678901234
ows fetch --target-market US --output results.json
ows fetch --last-days 30 --target-market US
# Get products from the last 30 days
ows recent --target-market US
# Get product hierarchies
ows hierarchy --gtin 12345678901234
Basic Usage
from oneworldsync import Content1Client
# Initialize client with credentials
client = Content1Client(
app_id="your_app_id",
secret_key="your_secret_key",
gln="your_gln" # Optional
)
# Count products
count = client.count_products()
print(f"Total products: {count}")
# Fetch products by GTIN
products = client.fetch_products_by_gtin(["00000000000000"])
# Fetch products by target market
products = client.fetch_products_by_target_market("US")
Using the Criteria Builder
The library provides a fluent interface for building search criteria:
from oneworldsync import ProductCriteria, DateRangeCriteria, SortField
# Create criteria using the builder pattern
criteria = ProductCriteria() \
.with_target_market("US") \
.with_last_modified_date(DateRangeCriteria.last_30_days()) \
.with_brand_name("Brand Name") \
.with_sort([
SortField.create("lastModifiedDate", descending=True)
])
# Use the criteria with the client
products = client.fetch_products(criteria)
# Process results
for product in products:
print(f"{product.brand_name} - {product.gtin}")
Convenience Methods
# Get products from the last 30 days
products = client.fetch_products_last_30_days(target_market="US")
# Get products by date range
products = client.fetch_products_by_date_range(
from_date="2023-01-01",
to_date="2023-01-31",
target_market="US"
)
# Get products by brand
products = client.fetch_products_by_brand("Brand Name", target_market="US")
# Get products by GPC code
products = client.fetch_products_by_gpc_code("10000248", target_market="US")
Pagination
# Fetch first page
products = client.fetch_products(criteria, page_size=100)
# Process first page
for product in products:
print(f"GTIN: {product.gtin}")
# Check if there are more pages
if products.search_after:
# Fetch next page
next_page = client.fetch_next_page(products, original_criteria=criteria)
Documentation
For more detailed documentation, see the full documentation.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for oneworldsync 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oneworldsync-0.3.3.tar.gz | 20.9 kB | Without provenance | Details for oneworldsync-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oneworldsync-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for oneworldsync-0.3.3-py3-none-any.whl |
Total release size: 38.6 kB
Release files / oneworldsync-0.3.3.tar.gz
| Download URL | oneworldsync-0.3.3.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5bf25c7a43ffd26ce89bb7ff3b77ed815d0006fb88dc60202a78195cc5d0d0a
|
|
BLAKE2b-256 checksum How to use checksums |
517f60c40baade15b11c8a335ec9ee7c12358dd6b49f86234694eee53bf9a0a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / oneworldsync-0.3.3-py3-none-any.whl
| Download URL | oneworldsync-0.3.3-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bb53dd1517587ed6a289df71fcd3155e39f9df54b8dd6efd173ba2390b7c104
|
|
BLAKE2b-256 checksum How to use checksums |
dbe8b949459bc55131962443eb3f6eeb4326b420c2bffedbce5acd062de8ba97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for oneworldsync 0.3.3
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.