Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,5 @@ dmypy.json
cython_debug/

env.env
AGENTS.md
models
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ from sp_api.api import DataKiosk
from sp_api.api import Feeds
from sp_api.base import SellingApiException
from sp_api.base.reportTypes import ReportType
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone

# DATA KIOSK API
client = DataKiosk()
Expand All @@ -80,7 +80,7 @@ print(res)

# orders API
try:
res = Orders().get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())
res = Orders().get_orders(CreatedAfter=(datetime.now(timezone.utc) - timedelta(days=7)).isoformat())
print(res.payload) # json data
except SellingApiException as ex:
print(ex)
Expand All @@ -96,11 +96,11 @@ Feeds().submit_feed(<feed_type>, <file_or_bytes_io>, content_type='text/tsv', **

# PII Data

Orders(restricted_data_token='<token>').get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())
Orders(restricted_data_token='<token>').get_orders(CreatedAfter=(datetime.now(timezone.utc) - timedelta(days=7)).isoformat())

# or use the shortcut
orders = Orders().get_orders(
LastUpdatedAfter=(datetime.utcnow() - timedelta(days=1)).isoformat()
LastUpdatedAfter=(datetime.now(timezone.utc) - timedelta(days=1)).isoformat()
)
```

Expand All @@ -110,7 +110,7 @@ orders = Orders().get_orders(

```python
import asyncio
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone

from sp_api.asyncio.api import Orders, Reports
from sp_api.base.reportTypes import ReportType
Expand All @@ -119,7 +119,7 @@ from sp_api.base.reportTypes import ReportType
async def main():
async with Orders() as orders_client:
res = await orders_client.get_orders(
LastUpdatedAfter=(datetime.utcnow() - timedelta(days=1)).isoformat()
LastUpdatedAfter=(datetime.now(timezone.utc) - timedelta(days=1)).isoformat()
)
print(res.payload)

Expand Down
4 changes: 2 additions & 2 deletions docs/async.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Basic usage
.. code-block:: python

import asyncio
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone

from sp_api.asyncio.api import Orders, Reports
from sp_api.base.reportTypes import ReportType
Expand All @@ -30,7 +30,7 @@ Basic usage
async def main():
async with Orders() as orders_client:
res = await orders_client.get_orders(
LastUpdatedAfter=(datetime.utcnow() - timedelta(days=1)).isoformat()
LastUpdatedAfter=(datetime.now(timezone.utc) - timedelta(days=1)).isoformat()
)
print(res.payload)

Expand Down
9 changes: 4 additions & 5 deletions docs/config_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Usage with default account

.. code-block:: python

Orders().get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())
from datetime import datetime, timedelta, timezone
Orders().get_orders(CreatedAfter=(datetime.now(timezone.utc) - timedelta(days=7)).isoformat())


**************************
Expand All @@ -62,15 +63,15 @@ You can use every account's name from the config file for account

.. code-block:: python

Orders(account=another_account).get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())
Orders(account=another_account).get_orders(CreatedAfter=(datetime.now(timezone.utc) - timedelta(days=7)).isoformat())

.. note::

The refresh token can be passed directly to the client, too. You don't need to pass the whole credentials if all that changes is the refresh token.

.. code-block:: python

Orders(account='another_account', refresh_token='<refresh_token_for_this_request>').get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=7)).isoformat())
Orders(account='another_account', refresh_token='<refresh_token_for_this_request>').get_orders(CreatedAfter=(datetime.now(timezone.utc) - timedelta(days=7)).isoformat())


**********
Expand All @@ -81,5 +82,3 @@ References

.. _`credentials.yml`: https://github.com/saleweaver/python-amazon-sp-api/blob/master/credentials.yml
.. _`confused`: https://confuse.readthedocs.io/en/latest/usage.html#search-paths


11 changes: 9 additions & 2 deletions docs/endpoints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ You can use the playground to test endpoints:
endpoints/catalog
endpoints/catalog_items
endpoints/data_kiosk
endpoints/delivery_by_amazon
endpoints/easy_ship
endpoints/external_fulfillment_inventory
endpoints/external_fulfillment_returns
endpoints/external_fulfillment_shipping
endpoints/fba_inbound_eligibility
endpoints/fba_small_and_light
endpoints/feeds
endpoints/finances
endpoints/fulfillment_inbound
endpoints/fulfillment_outbound
endpoints/inventories
endpoints/invoices
endpoints/listings_items
endpoints/listings_restrictions
endpoints/merchant_fulfillment
Expand All @@ -36,9 +41,11 @@ You can use the playground to test endpoints:
endpoints/replenishment
endpoints/reports
endpoints/sales
endpoints/seller_wallet
endpoints/sellers
endpoints/services
endpoints/shipping
endpoints/shipment_invoicing
endpoints/solicitations
endpoints/supply_sources
endpoints/tokens
Expand All @@ -47,10 +54,10 @@ You can use the playground to test endpoints:
endpoints/vendor_direct_fulfillment_orders
endpoints/vendor_direct_fulfillment_payments
endpoints/vendor_direct_fulfillment_shipping
endpoints/vendor_direct_fulfillment_sandbox_test_data
endpoints/vendor_direct_fulfillment_transactions
endpoints/vendor_invoices
endpoints/vendor_orders
endpoints/vendor_shipments
endpoints/vendor_transaction_status


endpoints/vehicles
6 changes: 3 additions & 3 deletions docs/endpoints/awd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AmazonWarehousingAndDistribution
================================


.. toctree::
:maxdepth: 1

.. autoclass:: sp_api.api.AmazonWarehousingAndDistribution
:members:
:inherited-members:
awd_v2024_05_09
7 changes: 7 additions & 0 deletions docs/endpoints/awd_v2024_05_09.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AmazonWarehousingAndDistribution V2024_05_09
============================================


.. autoclass:: sp_api.api.AmazonWarehousingAndDistributionV20240509
:members:
:inherited-members:
7 changes: 5 additions & 2 deletions docs/endpoints/catalog_items.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ CatalogItems
============



.. autoclass:: sp_api.api.CatalogItems
.. toctree::
:maxdepth: 1

catalog_items_v2020_12_01
catalog_items_v2022_04_01
5 changes: 5 additions & 0 deletions docs/endpoints/catalog_items_v2020_12_01.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CatalogItems V2020_12_01
========================


.. autoclass:: sp_api.api.CatalogItemsV20201201
5 changes: 5 additions & 0 deletions docs/endpoints/catalog_items_v2022_04_01.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CatalogItems V2022_04_01
========================


.. autoclass:: sp_api.api.CatalogItemsV20220401
8 changes: 8 additions & 0 deletions docs/endpoints/delivery_by_amazon.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DeliveryByAmazon
================


.. toctree::
:maxdepth: 1

delivery_by_amazon_v2022_07_01
5 changes: 5 additions & 0 deletions docs/endpoints/delivery_by_amazon_v2022_07_01.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DeliveryByAmazon V2022_07_01
============================


.. autoclass:: sp_api.api.DeliveryByAmazonV20220701
9 changes: 9 additions & 0 deletions docs/endpoints/external_fulfillment_inventory.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ExternalFulfillmentInventory
============================


.. toctree::
:maxdepth: 1

external_fulfillment_inventory_v2021_01_06
external_fulfillment_inventory_v2024_09_11
5 changes: 5 additions & 0 deletions docs/endpoints/external_fulfillment_inventory_v2021_01_06.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ExternalFulfillmentInventory V2021_01_06
========================================


.. autoclass:: sp_api.api.ExternalFulfillmentInventoryV20210106
5 changes: 5 additions & 0 deletions docs/endpoints/external_fulfillment_inventory_v2024_09_11.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ExternalFulfillmentInventory V2024_09_11
========================================


.. autoclass:: sp_api.api.ExternalFulfillmentInventoryV20240911
9 changes: 9 additions & 0 deletions docs/endpoints/external_fulfillment_returns.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ExternalFulfillmentReturns
==========================


.. toctree::
:maxdepth: 1

external_fulfillment_returns_v2021_08_19
external_fulfillment_returns_v2024_09_11
5 changes: 5 additions & 0 deletions docs/endpoints/external_fulfillment_returns_v2021_08_19.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ExternalFulfillmentReturns V2021_08_19
======================================


.. autoclass:: sp_api.api.ExternalFulfillmentReturnsV20210819
5 changes: 5 additions & 0 deletions docs/endpoints/external_fulfillment_returns_v2024_09_11.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ExternalFulfillmentReturns V2024_09_11
======================================


.. autoclass:: sp_api.api.ExternalFulfillmentReturnsV20240911
9 changes: 9 additions & 0 deletions docs/endpoints/external_fulfillment_shipping.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ExternalFulfillmentShipping
===========================


.. toctree::
:maxdepth: 1

external_fulfillment_shipping_v2021_01_06
external_fulfillment_shipping_v2024_09_11
5 changes: 5 additions & 0 deletions docs/endpoints/external_fulfillment_shipping_v2021_01_06.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ExternalFulfillmentShipping V2021_01_06
=======================================


.. autoclass:: sp_api.api.ExternalFulfillmentShippingV20210106
5 changes: 5 additions & 0 deletions docs/endpoints/external_fulfillment_shipping_v2024_09_11.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ExternalFulfillmentShipping V2024_09_11
=======================================


.. autoclass:: sp_api.api.ExternalFulfillmentShippingV20240911
8 changes: 3 additions & 5 deletions docs/endpoints/feeds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ Feeds
=====


.. toctree::
:maxdepth: 1



.. autoclass:: sp_api.api.Feeds


feeds_v2021_06_30
5 changes: 5 additions & 0 deletions docs/endpoints/feeds_v2021_06_30.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Feeds V2021_06_30
=================


.. autoclass:: sp_api.api.FeedsV20210630
6 changes: 4 additions & 2 deletions docs/endpoints/finances.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Finances
========


.. toctree::
:maxdepth: 1


.. autoclass:: sp_api.api.Finances
finances_v0
finances_v2024_06_19
5 changes: 5 additions & 0 deletions docs/endpoints/finances_v0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Finances V0
===========


.. autoclass:: sp_api.api.FinancesV0
5 changes: 5 additions & 0 deletions docs/endpoints/finances_v2024_06_19.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Finances V2024_06_19
====================


.. autoclass:: sp_api.api.FinancesV20240619
7 changes: 4 additions & 3 deletions docs/endpoints/fulfillment_inbound.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FulfillmentInbound
==================



.. note::

To use the `load all pages decorator`_ for this endpoints, pass `extras` to it
Expand All @@ -15,6 +14,8 @@ FulfillmentInbound
@load_all_pages(extras=dict(QueryType='NEXT_TOKEN'))


.. toctree::
:maxdepth: 1


.. autoclass:: sp_api.api.FulfillmentInbound
fulfillment_inbound_v0
fulfillment_inbound_v2024_03_20
5 changes: 5 additions & 0 deletions docs/endpoints/fulfillment_inbound_v0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FulfillmentInbound V0
=====================


.. autoclass:: sp_api.api.FulfillmentInboundV0
5 changes: 5 additions & 0 deletions docs/endpoints/fulfillment_inbound_v2024_03_20.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FulfillmentInbound V2024_03_20
==============================


.. autoclass:: sp_api.api.FulfillmentInboundV20240320
8 changes: 8 additions & 0 deletions docs/endpoints/invoices.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Invoices
========


.. toctree::
:maxdepth: 1

invoices_v2024_06_19
5 changes: 5 additions & 0 deletions docs/endpoints/invoices_v2024_06_19.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Invoices V2024_06_19
====================


.. autoclass:: sp_api.api.InvoicesV20240619
8 changes: 6 additions & 2 deletions docs/endpoints/listings_items.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ListingsItems
=============


.. autoclass:: sp_api.api.ListingsItems

.. toctree::
:maxdepth: 1

listings_items_v2020_09_01
listings_items_v2021_08_01
5 changes: 5 additions & 0 deletions docs/endpoints/listings_items_v2020_09_01.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ListingsItems V2020_09_01
=========================


.. autoclass:: sp_api.api.ListingsItemsV20200901
5 changes: 5 additions & 0 deletions docs/endpoints/listings_items_v2021_08_01.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ListingsItems V2021_08_01
=========================


.. autoclass:: sp_api.api.ListingsItemsV20210801
Loading
Loading