amazon-orders 4.4.2__tar.gz → 4.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/CHANGELOG.md +8 -1
- {amazon_orders-4.4.2/amazon_orders.egg-info → amazon_orders-4.4.3}/PKG-INFO +1 -1
- {amazon_orders-4.4.2 → amazon_orders-4.4.3/amazon_orders.egg-info}/PKG-INFO +1 -1
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/__init__.py +1 -1
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/cli.py +66 -1
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/constants.py +1 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/orders.py +10 -2
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/LICENSE +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/MANIFEST.in +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/README.md +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazon_orders.egg-info/SOURCES.txt +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazon_orders.egg-info/dependency_links.txt +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazon_orders.egg-info/entry_points.txt +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazon_orders.egg-info/requires.txt +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazon_orders.egg-info/top_level.txt +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/banner.txt +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/conf.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/contrib/__init__.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/contrib/browser/__init__.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/contrib/browser/playwright.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/contrib/waf/__init__.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/contrib/waf/anticaptcha.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/contrib/waf/base.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/contrib/waf/capsolver.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/contrib/waf/twocaptcha.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/entity/__init__.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/entity/item.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/entity/order.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/entity/parsable.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/entity/recipient.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/entity/seller.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/entity/shipment.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/entity/transaction.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/exception.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/forms.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/selectors.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/session.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/transactions.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/amazonorders/util.py +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/pyproject.toml +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/setup.cfg +0 -0
- {amazon_orders-4.4.2 → amazon_orders-4.4.3}/tests/testcase.py +0 -0
|
@@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
-
## [Unreleased](https://github.com/alexdlaird/amazon-orders/compare/4.4.
|
|
7
|
+
## [Unreleased](https://github.com/alexdlaird/amazon-orders/compare/4.4.3...HEAD)
|
|
8
|
+
|
|
9
|
+
## [4.4.3](https://github.com/alexdlaird/amazon-orders/compare/4.4.2...4.4.3) - 2026-07-06
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `AmazonOrders.get_order_history()` `order_filter` parameter to filter by order type via Amazon's `orderFilter` query parameter. `--order-filter` added to the `history` CLI command.
|
|
14
|
+
- `invoice` and `order-transactions` CLI commands, adding parity with `AmazonOrders.get_invoice()` and `AmazonTransactions.get_transactions(order_id=)`.
|
|
8
15
|
|
|
9
16
|
## [4.4.2](https://github.com/alexdlaird/amazon-orders/compare/4.4.1...4.4.2) - 2026-07-05
|
|
10
17
|
|
|
@@ -126,6 +126,8 @@ def amazon_orders_cli(ctx: Context,
|
|
|
126
126
|
@click.option("--full-details", is_flag=True, default=False,
|
|
127
127
|
help="Get the full details for each Order in the history. "
|
|
128
128
|
"This will execute an additional request per Order.")
|
|
129
|
+
@click.option("--order-filter", "order_filter", default=None,
|
|
130
|
+
help="The order type filter to use.")
|
|
129
131
|
def history(ctx: Context,
|
|
130
132
|
**kwargs: Any) -> None:
|
|
131
133
|
"""
|
|
@@ -142,6 +144,7 @@ def history(ctx: Context,
|
|
|
142
144
|
start_index = kwargs["start_index"]
|
|
143
145
|
single_page = kwargs["single_page"]
|
|
144
146
|
full_details = kwargs["full_details"]
|
|
147
|
+
order_filter = kwargs["order_filter"]
|
|
145
148
|
|
|
146
149
|
exclusive_flags = [year, last_3_months, last_30_days]
|
|
147
150
|
if not all(not item for item in exclusive_flags) and sum(exclusive_flags) == 1:
|
|
@@ -180,7 +183,8 @@ Order History for {filter_description}{optional_start_index}{optional_full_detai
|
|
|
180
183
|
start_index=start_index,
|
|
181
184
|
full_details=full_details,
|
|
182
185
|
keep_paging=not single_page,
|
|
183
|
-
time_filter=time_filter
|
|
186
|
+
time_filter=time_filter,
|
|
187
|
+
order_filter=order_filter):
|
|
184
188
|
click.echo(f"{_order_output(o, config)}\n")
|
|
185
189
|
total += 1
|
|
186
190
|
end_time = time.time()
|
|
@@ -222,6 +226,67 @@ def order(ctx: Context,
|
|
|
222
226
|
ctx.fail(str(e))
|
|
223
227
|
|
|
224
228
|
|
|
229
|
+
@amazon_orders_cli.command()
|
|
230
|
+
@click.pass_context
|
|
231
|
+
@click.argument("order_id")
|
|
232
|
+
def invoice(ctx: Context,
|
|
233
|
+
order_id: str) -> None:
|
|
234
|
+
"""
|
|
235
|
+
Get the invoice for a given Amazon Order ID.
|
|
236
|
+
"""
|
|
237
|
+
amazon_session = ctx.obj["amazon_session"]
|
|
238
|
+
|
|
239
|
+
try:
|
|
240
|
+
_authenticate(amazon_session)
|
|
241
|
+
|
|
242
|
+
config = ctx.obj["conf"]
|
|
243
|
+
amazon_orders = AmazonOrders(amazon_session,
|
|
244
|
+
config=config)
|
|
245
|
+
|
|
246
|
+
invoice_response = amazon_orders.get_invoice(order_id)
|
|
247
|
+
|
|
248
|
+
click.echo(invoice_response.response.text)
|
|
249
|
+
except AmazonOrdersAuthRedirectError:
|
|
250
|
+
_prompt_to_reauth_flow()
|
|
251
|
+
except AmazonOrdersError as e:
|
|
252
|
+
logger.debug("An error occurred.", exc_info=True)
|
|
253
|
+
ctx.fail(str(e))
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
@amazon_orders_cli.command("order-transactions")
|
|
257
|
+
@click.pass_context
|
|
258
|
+
@click.argument("order_id")
|
|
259
|
+
def order_transactions(ctx: Context,
|
|
260
|
+
order_id: str) -> None:
|
|
261
|
+
"""
|
|
262
|
+
Get the Transactions for a given Amazon Order ID.
|
|
263
|
+
"""
|
|
264
|
+
amazon_session = ctx.obj["amazon_session"]
|
|
265
|
+
|
|
266
|
+
try:
|
|
267
|
+
_authenticate(amazon_session)
|
|
268
|
+
|
|
269
|
+
config = ctx.obj["conf"]
|
|
270
|
+
amazon_transactions = AmazonTransactions(amazon_session,
|
|
271
|
+
config=config)
|
|
272
|
+
|
|
273
|
+
start_time = time.time()
|
|
274
|
+
total = 0
|
|
275
|
+
for t in amazon_transactions.get_transactions(order_id=order_id):
|
|
276
|
+
click.echo(f"{_transaction_output(t, config)}\n")
|
|
277
|
+
total += 1
|
|
278
|
+
end_time = time.time()
|
|
279
|
+
|
|
280
|
+
click.echo(
|
|
281
|
+
"... {total} Transactions parsed in {time} seconds.\n".format(total=total,
|
|
282
|
+
time=int(end_time - start_time)))
|
|
283
|
+
except AmazonOrdersAuthRedirectError:
|
|
284
|
+
_prompt_to_reauth_flow()
|
|
285
|
+
except AmazonOrdersError as e:
|
|
286
|
+
logger.debug("An error occurred.", exc_info=True)
|
|
287
|
+
ctx.fail(str(e))
|
|
288
|
+
|
|
289
|
+
|
|
225
290
|
@amazon_orders_cli.command()
|
|
226
291
|
@click.pass_context
|
|
227
292
|
@click.option("--days", default=365,
|
|
@@ -112,6 +112,7 @@ class Constants:
|
|
|
112
112
|
ORDER_DETAILS_URL = f"{BASE_URL}/gp/your-account/order-details"
|
|
113
113
|
ORDER_INVOICE_URL = f"{BASE_URL}/gp/css/summary/print.html"
|
|
114
114
|
HISTORY_FILTER_QUERY_PARAM = "timeFilter"
|
|
115
|
+
ORDER_FILTER_QUERY_PARAM = "orderFilter"
|
|
115
116
|
|
|
116
117
|
##########################################################################
|
|
117
118
|
# URLs for Transactions
|
|
@@ -6,6 +6,7 @@ import concurrent.futures
|
|
|
6
6
|
import datetime
|
|
7
7
|
import logging
|
|
8
8
|
from typing import Any, Callable, List, Optional
|
|
9
|
+
from urllib.parse import quote
|
|
9
10
|
|
|
10
11
|
from bs4 import Tag
|
|
11
12
|
|
|
@@ -103,7 +104,8 @@ class AmazonOrders:
|
|
|
103
104
|
start_index: Optional[int] = None,
|
|
104
105
|
full_details: bool = False,
|
|
105
106
|
keep_paging: bool = True,
|
|
106
|
-
time_filter: Optional[str] = None
|
|
107
|
+
time_filter: Optional[str] = None,
|
|
108
|
+
order_filter: Optional[str] = None) -> List[Order]:
|
|
107
109
|
"""
|
|
108
110
|
Get the Amazon Order history for a given time period.
|
|
109
111
|
|
|
@@ -119,6 +121,7 @@ class AmazonOrders:
|
|
|
119
121
|
:param time_filter: The time filter to use. Supported values are ``"last30"`` (last 30 days),
|
|
120
122
|
``"months-3"`` (past 3 months), or ``"year-YYYY"`` (specific year). If provided, this takes
|
|
121
123
|
precedence over the ``year`` parameter.
|
|
124
|
+
:param order_filter: The order type filter to use. If provided, appended alongside the time filter.
|
|
122
125
|
:return: A list of the requested Orders.
|
|
123
126
|
"""
|
|
124
127
|
if not self.amazon_session.is_authenticated:
|
|
@@ -144,12 +147,17 @@ class AmazonOrders:
|
|
|
144
147
|
filter_value = f"year-{year}"
|
|
145
148
|
|
|
146
149
|
optional_start_index = f"&startIndex={start_index}" if start_index else ""
|
|
150
|
+
optional_order_filter = (
|
|
151
|
+
f"&{self.config.constants.ORDER_FILTER_QUERY_PARAM}={quote(order_filter, safe='')}"
|
|
152
|
+
if order_filter else ""
|
|
153
|
+
)
|
|
147
154
|
next_page: Optional[str] = (
|
|
148
|
-
"{url}?{query_param}={filter_value}{optional_start_index}"
|
|
155
|
+
"{url}?{query_param}={filter_value}{optional_order_filter}{optional_start_index}"
|
|
149
156
|
).format(
|
|
150
157
|
url=self.config.constants.ORDER_HISTORY_URL,
|
|
151
158
|
query_param=self.config.constants.HISTORY_FILTER_QUERY_PARAM,
|
|
152
159
|
filter_value=filter_value,
|
|
160
|
+
optional_order_filter=optional_order_filter,
|
|
153
161
|
optional_start_index=optional_start_index
|
|
154
162
|
)
|
|
155
163
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|