Metadata-Version: 2.1
Name: shopping-utils
Version: 0.2.0
Summary: Wrappers for shopping APIs like Google Merchant API, Bing Content API, etc.
Home-page: https://github.com/FG-IT/shopping-utils
Author: Neal Wong
Author-email: neal.wkacc@gmail.com
License: MIT
Keywords: google shopping,merchant api,content api
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Dist: requests
Requires-Dist: pycryptodome
Requires-Dist: google-api-python-client
Requires-Dist: google-auth
Requires-Dist: google-auth-httplib2
Requires-Dist: wrapt
Requires-Dist: six
Requires-Dist: bing-content-api

shopping-utils
=====================

Shopping utils aims to supply useful wrappers for shopping APIs like Google Merchant API and Bing Content API.

Google Shopping uses Merchant API (`products_v1` / `reports_v1` / `datasources_v1`). Content API for Shopping is sunset on August 18, 2026.

Before first Merchant API calls, link the Cloud project to Merchant Center (`developerRegistration:registerGcp`). Writes require an API primary data source.

```python
GoogleShopping(merchant_id, service_account_info, data_source='accounts/{account}/dataSources/{id}')
```

Product payloads may still use Content API field layout (`title`, `price.value`, `online:en:US:sku`). They are converted to Merchant API `productInputs` (`productAttributes`, `amountMicros`, `en~US~sku`) on write.

Long-running jobs (`update_expiration`, `cleanup`) checkpoint by default. Existing files are looked up in this order:

1. `checkpoint_path=` argument
2. `GoogleShopping(..., checkpoint_dir=...)`
3. environment variable `SHOPPING_UTILS_CHECKPOINT_DIR`
4. `./shopping-utils-checkpoints/merchant-{id}-{operation}.json`
5. `~/.shopping-utils/checkpoints/merchant-{id}-{operation}.json`

If none exist, a new file is created in the first available directory above. Failed writes go to `{checkpoint_path}.failed.jsonl` and are retried on resume. Delete/patch treats HTTP 404 as already done. Re-run the same command to continue; `resume=False` starts a new job; `checkpoint_path=False` disables checkpointing.

```python
shopping.update_expiration()
for _ in shopping.cleanup():
    pass
```

Installation
-------------

You can install shopping-utils with `pip`:

    pip install shopping-utils


