Skip to content

Commit

Permalink
Update README and publish to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
jiulongw committed Jun 23, 2021
1 parent 8422c03 commit 511ef3f
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 4 deletions.
69 changes: 68 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# tap-amazon-sp (Working in progress...)
# tap-amazon-sp

This is a [Singer][1] tap that produces JSON-formatted data following the [Singer spec][2].

Expand All @@ -10,6 +10,69 @@ This tap:
- Outputs the schema for each resource
- Incrementally pulls data based on the input state

## Install

```
pip install tap-amazon-sp
```

## Usage

1. Follow [Singer.io Best Practices][5] for setting up separate `tap` and `target` virtualenvs to avoid version conflicts.
2. Create a [config file][6] ~/config.json with [Amazon Seller Partner API credentials][7]. Multiple accounts across
different marketplaces are supported. Here is [a list of marketplace names][8].
```json
{
"accounts": [
{
"selling_partner_id": "NA_SELLING_PARTNER_ID",
"marketplaces": ["US", "MX", "CA"],
"refresh_token": "env[NA_REFRESH_TOKEN]"
},
{
"selling_partner_id": "AU_SELLING_PARTNER_ID",
"marketplaces": ["AU"],
"refresh_token": "env[AU_REFRESH_TOKEN]"
}
],
"access_key_id": "ACCESS_KEY_ID",
"secret_access_key": "env[SECRET_ACCESS_KEY]",
"sp_role_arn": "arn:aws:iam::1234567890:role/RoleName",
"lwa_client_id": "CLIENT_ID",
"lwa_client_secret": "env[LWA_CLIENT_SECRET]",
"start_date": "2021-01-01T00:00:00Z",
"rate_limit_backoff_seconds": 60
}
```
3. Discover catalog: `tap-amazon-sp -d > catalog.json`
4. Select `orders` stream in the generated `catalog.json`.
```
...
"stream": "orders",
"metadata": [
{
"breadcrumb": [],
"metadata": {
"table-key-properties": [
"AmazonOrderId"
],
"forced-replication-method": "INCREMENTAL",
"valid-replication-keys": [
"LastUpdateDate"
],
"inclusion": "available",
"selected": true <-- Somewhere in the huge catalog file, in stream metadata.
}
},
...
]
...
```
5. Use following command to sync all orders with order items, buyer info and shipping address (when available).
```bash
tap-amazon-sp -c config.json --catalog catalog.json > output.txt
```

---

Copyright &copy; 2021 Vibe Inc
Expand All @@ -18,3 +81,7 @@ Copyright &copy; 2021 Vibe Inc
[2]: https://github.com/singer-io/getting-started/blob/master/SPEC.md
[3]: https://github.com/amzn/selling-partner-api-docs
[4]: https://github.com/amzn/selling-partner-api-docs/blob/main/references/orders-api/ordersV0.md
[5]: https://github.com/singer-io/getting-started/blob/master/docs/RUNNING_AND_DEVELOPING.md#running-a-singer-tap-with-a-singer-target
[6]: https://github.com/vibeus/tap-amazon-sp/blob/master/sample_config.json
[7]: https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#creating-and-configuring-iam-policies-and-entities
[8]: https://github.com/saleweaver/python-amazon-sp-api/blob/master/sp_api/base/marketplaces.py
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/usr/bin/env python
from setuptools import setup

with open('README.md') as f:
long_description = f.read()

setup(
name="tap-amazon-sp",
version="0.1.0",
description="Singer.io tap for extracting data from Amazon Seller Central.",
version="0.1.1",
description="Singer.io tap for extracting data from Amazon Seller Partner API.",
long_description=long_description,
long_description_content_type='text/markdown',
author="Vibe Inc",
url="https://vibe.us",
url="https://github.com/vibeus/tap-amazon-sp",
classifiers=["Programming Language :: Python :: 3 :: Only"],
py_modules=["tap_amazon_sp"],
install_requires=[
Expand Down

0 comments on commit 511ef3f

Please sign in to comment.