amazon-orders 3.2.6__tar.gz → 3.2.8__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-3.2.6 → amazon_orders-3.2.8}/CHANGELOG.md +13 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/LICENSE +1 -1
- {amazon_orders-3.2.6/amazon_orders.egg-info → amazon_orders-3.2.8}/PKG-INFO +13 -11
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/README.md +7 -5
- {amazon_orders-3.2.6 → amazon_orders-3.2.8/amazon_orders.egg-info}/PKG-INFO +13 -11
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazon_orders.egg-info/requires.txt +3 -3
- amazon_orders-3.2.8/amazonorders/__init__.py +3 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/cli.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/constants.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/entity/item.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/entity/order.py +3 -3
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/entity/parsable.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/entity/recipient.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/entity/seller.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/entity/shipment.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/entity/transaction.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/exception.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/forms.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/orders.py +1 -6
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/selectors.py +6 -6
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/session.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/transactions.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/util.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/pyproject.toml +4 -4
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/tests/test_cli.py +2 -2
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/tests/test_conf.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/tests/test_orders.py +18 -6
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/tests/test_session.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/tests/test_transactions.py +27 -33
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/tests/test_util.py +1 -1
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/tests/testcase.py +1 -1
- amazon_orders-3.2.6/amazonorders/__init__.py +0 -3
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/MANIFEST.in +0 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazon_orders.egg-info/SOURCES.txt +0 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazon_orders.egg-info/dependency_links.txt +0 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazon_orders.egg-info/entry_points.txt +0 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazon_orders.egg-info/top_level.txt +0 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/banner.txt +0 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/conf.py +0 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/amazonorders/entity/__init__.py +0 -0
- {amazon_orders-3.2.6 → amazon_orders-3.2.8}/setup.cfg +0 -0
|
@@ -4,7 +4,19 @@ 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/3.2.
|
|
7
|
+
## [Unreleased](https://github.com/alexdlaird/amazon-orders/compare/3.2.8...HEAD)
|
|
8
|
+
|
|
9
|
+
## [3.2.8](https://github.com/alexdlaird/amazon-orders/compare/3.2.7...3.2.8) - 2025-02-18
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Dependency and documentation improvements (including fixing links to BeautifulSoup entities).
|
|
14
|
+
|
|
15
|
+
## [3.2.7](https://github.com/alexdlaird/amazon-orders/compare/3.2.6...3.2.7) - 2025-02-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Fixes for parsing Amazon Fresh and Whole Foods Market orders, so they no longer need to be skipped (but their Items and Shipments will still be empty).
|
|
8
20
|
|
|
9
21
|
## [3.2.6](https://github.com/alexdlaird/amazon-orders/compare/3.2.5...3.2.6) - 2025-02-17
|
|
10
22
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: amazon-orders
|
|
3
|
-
Version: 3.2.
|
|
4
|
-
Summary: A
|
|
3
|
+
Version: 3.2.8
|
|
4
|
+
Summary: A library for interacting with Amazon order history in Python and from the CLI
|
|
5
5
|
Maintainer-email: Alex Laird <contact@alexlaird.com>
|
|
6
6
|
License: MIT License
|
|
7
7
|
|
|
8
|
-
Copyright (c) 2024 Alex Laird
|
|
8
|
+
Copyright (c) 2024-2025 Alex Laird
|
|
9
9
|
|
|
10
10
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
11
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -48,9 +48,9 @@ License-File: LICENSE
|
|
|
48
48
|
Requires-Dist: click>=7.1
|
|
49
49
|
Requires-Dist: requests>=2.23
|
|
50
50
|
Requires-Dist: amazoncaptcha>=0.4
|
|
51
|
-
Requires-Dist: beautifulsoup4>=4.
|
|
51
|
+
Requires-Dist: beautifulsoup4>=4.12
|
|
52
52
|
Requires-Dist: PyYAML>=5.1
|
|
53
|
-
Requires-Dist: python-dateutil>=2.8
|
|
53
|
+
Requires-Dist: python-dateutil>=2.8
|
|
54
54
|
Provides-Extra: dev
|
|
55
55
|
Requires-Dist: pytest; extra == "dev"
|
|
56
56
|
Requires-Dist: parameterized; extra == "dev"
|
|
@@ -64,7 +64,7 @@ Requires-Dist: twilio; extra == "dev"
|
|
|
64
64
|
Requires-Dist: pyngrok; extra == "dev"
|
|
65
65
|
Requires-Dist: lxml; extra == "dev"
|
|
66
66
|
Provides-Extra: docs
|
|
67
|
-
Requires-Dist: Sphinx; extra == "docs"
|
|
67
|
+
Requires-Dist: Sphinx<8.2; extra == "docs"
|
|
68
68
|
Requires-Dist: sphinx-notfound-page; extra == "docs"
|
|
69
69
|
Requires-Dist: sphinx_autodoc_typehints; extra == "docs"
|
|
70
70
|
Requires-Dist: mypy; extra == "docs"
|
|
@@ -74,7 +74,7 @@ Requires-Dist: types-Pillow; extra == "docs"
|
|
|
74
74
|
Requires-Dist: types-PyYAML; extra == "docs"
|
|
75
75
|
Requires-Dist: types-python-dateutil; extra == "docs"
|
|
76
76
|
|
|
77
|
-
<p align="center"><img alt="amazon-orders -
|
|
77
|
+
<p align="center"><img alt="amazon-orders - A library for interacting with Amazon order history in Python and from the CLI" src="https://amazon-orders.readthedocs.io/_images/logo.png" /></p>
|
|
78
78
|
|
|
79
79
|
[](https://pypi.org/project/amazon-orders)
|
|
80
80
|
[](https://pypi.org/project/amazon-orders)
|
|
@@ -84,11 +84,13 @@ Requires-Dist: types-python-dateutil; extra == "docs"
|
|
|
84
84
|
[](https://github.com/alexdlaird/amazon-orders/blob/main/LICENSE)
|
|
85
85
|
|
|
86
86
|
`amazon-orders` is an unofficial library that provides a command line interface alongside a programmatic API that can
|
|
87
|
-
be used to interact with Amazon
|
|
87
|
+
be used to interact with Amazon's consumer-facing website.
|
|
88
88
|
|
|
89
|
-
This works by parsing website data from Amazon.
|
|
90
|
-
stability, but as Amazon provides no official API to use, this package may break at any time.
|
|
91
|
-
|
|
89
|
+
This package works by parsing website data from Amazon. A periodic build validates functionality to ensure its
|
|
90
|
+
stability, but as Amazon provides no official API to use, this package may break at any time. Pin the [minor
|
|
91
|
+
(not patch) version](https://semver.org/) wildcard (ex. `==1.1.*`, not `==1.1.4`) to ensure you always get the latest stable release.
|
|
92
|
+
|
|
93
|
+
This package only officially supports the English, `.com` version of Amazon.
|
|
92
94
|
|
|
93
95
|
## Installation
|
|
94
96
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<p align="center"><img alt="amazon-orders -
|
|
1
|
+
<p align="center"><img alt="amazon-orders - A library for interacting with Amazon order history in Python and from the CLI" src="https://amazon-orders.readthedocs.io/_images/logo.png" /></p>
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/amazon-orders)
|
|
4
4
|
[](https://pypi.org/project/amazon-orders)
|
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
[](https://github.com/alexdlaird/amazon-orders/blob/main/LICENSE)
|
|
9
9
|
|
|
10
10
|
`amazon-orders` is an unofficial library that provides a command line interface alongside a programmatic API that can
|
|
11
|
-
be used to interact with Amazon
|
|
11
|
+
be used to interact with Amazon's consumer-facing website.
|
|
12
12
|
|
|
13
|
-
This works by parsing website data from Amazon.
|
|
14
|
-
stability, but as Amazon provides no official API to use, this package may break at any time.
|
|
15
|
-
|
|
13
|
+
This package works by parsing website data from Amazon. A periodic build validates functionality to ensure its
|
|
14
|
+
stability, but as Amazon provides no official API to use, this package may break at any time. Pin the [minor
|
|
15
|
+
(not patch) version](https://semver.org/) wildcard (ex. `==1.1.*`, not `==1.1.4`) to ensure you always get the latest stable release.
|
|
16
|
+
|
|
17
|
+
This package only officially supports the English, `.com` version of Amazon.
|
|
16
18
|
|
|
17
19
|
## Installation
|
|
18
20
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: amazon-orders
|
|
3
|
-
Version: 3.2.
|
|
4
|
-
Summary: A
|
|
3
|
+
Version: 3.2.8
|
|
4
|
+
Summary: A library for interacting with Amazon order history in Python and from the CLI
|
|
5
5
|
Maintainer-email: Alex Laird <contact@alexlaird.com>
|
|
6
6
|
License: MIT License
|
|
7
7
|
|
|
8
|
-
Copyright (c) 2024 Alex Laird
|
|
8
|
+
Copyright (c) 2024-2025 Alex Laird
|
|
9
9
|
|
|
10
10
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
11
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -48,9 +48,9 @@ License-File: LICENSE
|
|
|
48
48
|
Requires-Dist: click>=7.1
|
|
49
49
|
Requires-Dist: requests>=2.23
|
|
50
50
|
Requires-Dist: amazoncaptcha>=0.4
|
|
51
|
-
Requires-Dist: beautifulsoup4>=4.
|
|
51
|
+
Requires-Dist: beautifulsoup4>=4.12
|
|
52
52
|
Requires-Dist: PyYAML>=5.1
|
|
53
|
-
Requires-Dist: python-dateutil>=2.8
|
|
53
|
+
Requires-Dist: python-dateutil>=2.8
|
|
54
54
|
Provides-Extra: dev
|
|
55
55
|
Requires-Dist: pytest; extra == "dev"
|
|
56
56
|
Requires-Dist: parameterized; extra == "dev"
|
|
@@ -64,7 +64,7 @@ Requires-Dist: twilio; extra == "dev"
|
|
|
64
64
|
Requires-Dist: pyngrok; extra == "dev"
|
|
65
65
|
Requires-Dist: lxml; extra == "dev"
|
|
66
66
|
Provides-Extra: docs
|
|
67
|
-
Requires-Dist: Sphinx; extra == "docs"
|
|
67
|
+
Requires-Dist: Sphinx<8.2; extra == "docs"
|
|
68
68
|
Requires-Dist: sphinx-notfound-page; extra == "docs"
|
|
69
69
|
Requires-Dist: sphinx_autodoc_typehints; extra == "docs"
|
|
70
70
|
Requires-Dist: mypy; extra == "docs"
|
|
@@ -74,7 +74,7 @@ Requires-Dist: types-Pillow; extra == "docs"
|
|
|
74
74
|
Requires-Dist: types-PyYAML; extra == "docs"
|
|
75
75
|
Requires-Dist: types-python-dateutil; extra == "docs"
|
|
76
76
|
|
|
77
|
-
<p align="center"><img alt="amazon-orders -
|
|
77
|
+
<p align="center"><img alt="amazon-orders - A library for interacting with Amazon order history in Python and from the CLI" src="https://amazon-orders.readthedocs.io/_images/logo.png" /></p>
|
|
78
78
|
|
|
79
79
|
[](https://pypi.org/project/amazon-orders)
|
|
80
80
|
[](https://pypi.org/project/amazon-orders)
|
|
@@ -84,11 +84,13 @@ Requires-Dist: types-python-dateutil; extra == "docs"
|
|
|
84
84
|
[](https://github.com/alexdlaird/amazon-orders/blob/main/LICENSE)
|
|
85
85
|
|
|
86
86
|
`amazon-orders` is an unofficial library that provides a command line interface alongside a programmatic API that can
|
|
87
|
-
be used to interact with Amazon
|
|
87
|
+
be used to interact with Amazon's consumer-facing website.
|
|
88
88
|
|
|
89
|
-
This works by parsing website data from Amazon.
|
|
90
|
-
stability, but as Amazon provides no official API to use, this package may break at any time.
|
|
91
|
-
|
|
89
|
+
This package works by parsing website data from Amazon. A periodic build validates functionality to ensure its
|
|
90
|
+
stability, but as Amazon provides no official API to use, this package may break at any time. Pin the [minor
|
|
91
|
+
(not patch) version](https://semver.org/) wildcard (ex. `==1.1.*`, not `==1.1.4`) to ensure you always get the latest stable release.
|
|
92
|
+
|
|
93
|
+
This package only officially supports the English, `.com` version of Amazon.
|
|
92
94
|
|
|
93
95
|
## Installation
|
|
94
96
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
click>=7.1
|
|
2
2
|
requests>=2.23
|
|
3
3
|
amazoncaptcha>=0.4
|
|
4
|
-
beautifulsoup4>=4.
|
|
4
|
+
beautifulsoup4>=4.12
|
|
5
5
|
PyYAML>=5.1
|
|
6
|
-
python-dateutil>=2.8
|
|
6
|
+
python-dateutil>=2.8
|
|
7
7
|
|
|
8
8
|
[dev]
|
|
9
9
|
pytest
|
|
@@ -19,7 +19,7 @@ pyngrok
|
|
|
19
19
|
lxml
|
|
20
20
|
|
|
21
21
|
[docs]
|
|
22
|
-
Sphinx
|
|
22
|
+
Sphinx<8.2
|
|
23
23
|
sphinx-notfound-page
|
|
24
24
|
sphinx_autodoc_typehints
|
|
25
25
|
mypy
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__copyright__ = "Copyright (c) 2024 Alex Laird"
|
|
1
|
+
__copyright__ = "Copyright (c) 2024-2025 Alex Laird"
|
|
2
2
|
__license__ = "MIT"
|
|
3
3
|
|
|
4
4
|
import json
|
|
@@ -92,7 +92,7 @@ class Order(Parsable):
|
|
|
92
92
|
return f"Order #{self.order_number}: {self.items}"
|
|
93
93
|
|
|
94
94
|
def _parse_shipments(self) -> List[Shipment]:
|
|
95
|
-
if not self.parsed:
|
|
95
|
+
if not self.parsed or len(util.select(self.parsed, self.config.selectors.ORDER_SKIP_ITEMS)) > 0:
|
|
96
96
|
return []
|
|
97
97
|
|
|
98
98
|
shipments: List[Shipment] = [self.config.shipment_cls(x, self.config)
|
|
@@ -102,7 +102,7 @@ class Order(Parsable):
|
|
|
102
102
|
return shipments
|
|
103
103
|
|
|
104
104
|
def _parse_items(self) -> List[Item]:
|
|
105
|
-
if not self.parsed:
|
|
105
|
+
if not self.parsed or len(util.select(self.parsed, self.config.selectors.ORDER_SKIP_ITEMS)) > 0:
|
|
106
106
|
return []
|
|
107
107
|
|
|
108
108
|
items: List[Item] = [self.config.item_cls(x, self.config)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__copyright__ = "Copyright (c) 2024 Alex Laird"
|
|
1
|
+
__copyright__ = "Copyright (c) 2024-2025 Alex Laird"
|
|
2
2
|
__license__ = "MIT"
|
|
3
3
|
|
|
4
4
|
import datetime
|
|
@@ -73,11 +73,6 @@ class AmazonOrders:
|
|
|
73
73
|
response_parsed = self.amazon_session.last_response_parsed
|
|
74
74
|
|
|
75
75
|
for order_tag in util.select(response_parsed, self.config.selectors.ORDER_HISTORY_ENTITY_SELECTOR):
|
|
76
|
-
# First check if this Order is known to be of a type that we do not currently have a way to support
|
|
77
|
-
# parsing, meaning it should be skipped
|
|
78
|
-
if util.select(order_tag, self.config.selectors.ORDER_HISTORY_BRAND_SELECTOR):
|
|
79
|
-
continue
|
|
80
|
-
|
|
81
76
|
order: Order = self.config.order_cls(order_tag, self.config)
|
|
82
77
|
|
|
83
78
|
if full_details:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__copyright__ = "Copyright (c) 2024 Alex Laird"
|
|
1
|
+
__copyright__ = "Copyright (c) 2024-2025 Alex Laird"
|
|
2
2
|
__license__ = "MIT"
|
|
3
3
|
|
|
4
4
|
|
|
@@ -55,12 +55,12 @@ class Selectors:
|
|
|
55
55
|
SHIPMENT_ENTITY_SELECTOR = ["[data-component='orderCard'] [data-component='shipments'] .a-box",
|
|
56
56
|
"div.shipment",
|
|
57
57
|
"div.delivery-box"]
|
|
58
|
-
# Selectors defined here
|
|
59
|
-
#
|
|
60
|
-
|
|
61
|
-
# Amazon Fresh
|
|
58
|
+
# Selectors defined here mean we don't have a reliable way to parse all details in an Order, so Items and
|
|
59
|
+
# Shipments will be skipped
|
|
60
|
+
ORDER_SKIP_ITEMS = [
|
|
61
|
+
# Identifies an Amazon Fresh order
|
|
62
62
|
".brand-info-box .brand-logo img",
|
|
63
|
-
# Whole Foods Market
|
|
63
|
+
# Identifies a Whole Foods Market order
|
|
64
64
|
"a.yohtmlc-order-details-link[href^='/wholefoodsmarket']"
|
|
65
65
|
]
|
|
66
66
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "amazon-orders"
|
|
3
3
|
dynamic = ["version"]
|
|
4
|
-
description = "A
|
|
4
|
+
description = "A library for interacting with Amazon order history in Python and from the CLI"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = { file = "LICENSE" }
|
|
7
7
|
maintainers = [{ name = "Alex Laird", email = "contact@alexlaird.com" }]
|
|
@@ -10,9 +10,9 @@ dependencies = [
|
|
|
10
10
|
"click>=7.1",
|
|
11
11
|
"requests>=2.23",
|
|
12
12
|
"amazoncaptcha>=0.4",
|
|
13
|
-
"beautifulsoup4>=4.
|
|
13
|
+
"beautifulsoup4>=4.12",
|
|
14
14
|
"PyYAML>=5.1",
|
|
15
|
-
"python-dateutil>=2.8
|
|
15
|
+
"python-dateutil>=2.8"
|
|
16
16
|
]
|
|
17
17
|
classifiers = [
|
|
18
18
|
"Development Status :: 5 - Production/Stable",
|
|
@@ -45,7 +45,7 @@ dev = [
|
|
|
45
45
|
"lxml"
|
|
46
46
|
]
|
|
47
47
|
docs = [
|
|
48
|
-
"Sphinx",
|
|
48
|
+
"Sphinx<8.2",
|
|
49
49
|
"sphinx-notfound-page",
|
|
50
50
|
"sphinx_autodoc_typehints",
|
|
51
51
|
"mypy",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__copyright__ = "Copyright (c) 2024 Alex Laird"
|
|
1
|
+
__copyright__ = "Copyright (c) 2024-2025 Alex Laird"
|
|
2
2
|
__license__ = "MIT"
|
|
3
3
|
|
|
4
4
|
import datetime
|
|
@@ -92,7 +92,7 @@ class TestCli(UnitTestCase):
|
|
|
92
92
|
mock_get_today.date.today.return_value = datetime.date(2024, 10, 11)
|
|
93
93
|
days = 1
|
|
94
94
|
self.given_login_responses_success()
|
|
95
|
-
with open(os.path.join(self.RESOURCES_DIR, "transactions", "get-transactions.html"),
|
|
95
|
+
with open(os.path.join(self.RESOURCES_DIR, "transactions", "get-transactions-snippet.html"),
|
|
96
96
|
"r", encoding="utf-8") as f:
|
|
97
97
|
resp = responses.add(
|
|
98
98
|
responses.GET,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__copyright__ = "Copyright (c) 2024 Alex Laird"
|
|
1
|
+
__copyright__ = "Copyright (c) 2024-2025 Alex Laird"
|
|
2
2
|
__license__ = "MIT"
|
|
3
3
|
|
|
4
4
|
import os
|
|
@@ -98,7 +98,7 @@ class TestOrders(UnitTestCase):
|
|
|
98
98
|
orders = self.amazon_orders.get_order_history(year=year, start_index=start_index)
|
|
99
99
|
|
|
100
100
|
# THEN
|
|
101
|
-
self.assertEqual(
|
|
101
|
+
self.assertEqual(10, len(orders))
|
|
102
102
|
self.assertEqual(1, resp1.call_count)
|
|
103
103
|
self.assertEqual(1, resp2.call_count)
|
|
104
104
|
order = orders[5]
|
|
@@ -139,7 +139,7 @@ class TestOrders(UnitTestCase):
|
|
|
139
139
|
self.assertEqual(1, resp3.call_count)
|
|
140
140
|
|
|
141
141
|
@responses.activate
|
|
142
|
-
def
|
|
142
|
+
def test_get_order_history_fresh(self):
|
|
143
143
|
# GIVEN
|
|
144
144
|
self.amazon_session.is_authenticated = True
|
|
145
145
|
year = 2024
|
|
@@ -158,12 +158,18 @@ class TestOrders(UnitTestCase):
|
|
|
158
158
|
orders = self.amazon_orders.get_order_history(year=year, start_index=start_index)
|
|
159
159
|
|
|
160
160
|
# THEN
|
|
161
|
-
self.assertEqual(
|
|
161
|
+
self.assertEqual(10, len(orders))
|
|
162
162
|
self.assertEqual(1, resp1.call_count)
|
|
163
163
|
self.assertEqual(1, resp2.call_count)
|
|
164
|
+
order = orders[4]
|
|
165
|
+
self.assertEqual("111-2072777-8279433", order.order_number)
|
|
166
|
+
self.assertEqual(80.27, order.grand_total)
|
|
167
|
+
self.assertIsNotNone(order.order_details_link)
|
|
168
|
+
self.assertEqual(date(2025, 1, 3), order.order_placed_date)
|
|
169
|
+
self.assertEqual(0, len(order.items))
|
|
164
170
|
|
|
165
171
|
@responses.activate
|
|
166
|
-
def
|
|
172
|
+
def test_get_order_history_wholefoods(self):
|
|
167
173
|
# GIVEN
|
|
168
174
|
self.amazon_session.is_authenticated = True
|
|
169
175
|
year = 2024
|
|
@@ -182,9 +188,15 @@ class TestOrders(UnitTestCase):
|
|
|
182
188
|
orders = self.amazon_orders.get_order_history(year=year, start_index=start_index)
|
|
183
189
|
|
|
184
190
|
# THEN
|
|
185
|
-
self.assertEqual(
|
|
191
|
+
self.assertEqual(10, len(orders))
|
|
186
192
|
self.assertEqual(1, resp1.call_count)
|
|
187
193
|
self.assertEqual(1, resp2.call_count)
|
|
194
|
+
order = orders[7]
|
|
195
|
+
self.assertEqual("113-6307059-7336242", order.order_number)
|
|
196
|
+
self.assertEqual(62.92, order.grand_total)
|
|
197
|
+
self.assertIsNotNone(order.order_details_link)
|
|
198
|
+
self.assertEqual(date(2024, 12, 12), order.order_placed_date)
|
|
199
|
+
self.assertEqual(0, len(order.items))
|
|
188
200
|
|
|
189
201
|
@responses.activate
|
|
190
202
|
def test_get_order_history_full_details(self):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__copyright__ = "Copyright (c) 2024 Alex Laird"
|
|
1
|
+
__copyright__ = "Copyright (c) 2024-2025 Alex Laird"
|
|
2
2
|
__license__ = "MIT"
|
|
3
3
|
|
|
4
4
|
import datetime
|
|
@@ -37,11 +37,9 @@ class TestOrders(UnitTestCase):
|
|
|
37
37
|
mock_get_today.date.today.return_value = datetime.date(2024, 10, 11)
|
|
38
38
|
days = 1
|
|
39
39
|
self.amazon_session.is_authenticated = True
|
|
40
|
-
with open(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
encoding="utf-8",
|
|
44
|
-
) as f:
|
|
40
|
+
with open(os.path.join(self.RESOURCES_DIR, "transactions", "get-transactions-snippet.html"),
|
|
41
|
+
"r",
|
|
42
|
+
encoding="utf-8") as f:
|
|
45
43
|
responses.add(
|
|
46
44
|
responses.GET,
|
|
47
45
|
f"{self.test_config.constants.TRANSACTION_HISTORY_LANDING_URL}",
|
|
@@ -71,11 +69,9 @@ class TestOrders(UnitTestCase):
|
|
|
71
69
|
mock_get_today.date.today.return_value = datetime.date(2025, 2, 13)
|
|
72
70
|
days = 30
|
|
73
71
|
self.amazon_session.is_authenticated = True
|
|
74
|
-
with open(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
encoding="utf-8",
|
|
78
|
-
) as f:
|
|
72
|
+
with open(os.path.join(self.RESOURCES_DIR, "transactions", "transactions-in-progress.html"),
|
|
73
|
+
"r",
|
|
74
|
+
encoding="utf-8") as f:
|
|
79
75
|
responses.add(
|
|
80
76
|
responses.GET,
|
|
81
77
|
f"{self.test_config.constants.TRANSACTION_HISTORY_LANDING_URL}",
|
|
@@ -109,29 +105,27 @@ class TestOrders(UnitTestCase):
|
|
|
109
105
|
|
|
110
106
|
def test_parse_transaction_form_tag(self):
|
|
111
107
|
# GIVEN
|
|
112
|
-
with open(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
encoding="utf-8",
|
|
116
|
-
) as f:
|
|
108
|
+
with open(os.path.join(self.RESOURCES_DIR, "transactions", "transaction-form-tag.html"),
|
|
109
|
+
"r",
|
|
110
|
+
encoding="utf-8") as f:
|
|
117
111
|
parsed = BeautifulSoup(f.read(), self.test_config.bs4_parser)
|
|
118
112
|
form_tag = parsed.select_one("form")
|
|
119
113
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
# WHEN
|
|
115
|
+
transactions, next_page_url, next_page_data = _parse_transaction_form_tag(
|
|
116
|
+
form_tag, self.test_config
|
|
117
|
+
)
|
|
124
118
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
119
|
+
# THEN
|
|
120
|
+
self.assertEqual(len(transactions), 2)
|
|
121
|
+
self.assertEqual(
|
|
122
|
+
next_page_url, "https://www.amazon.com:443/cpe/yourpayments/transactions"
|
|
123
|
+
)
|
|
124
|
+
self.assertEqual(
|
|
125
|
+
next_page_data,
|
|
126
|
+
{
|
|
127
|
+
"ppw-widgetState": "the-ppw-widgetState",
|
|
128
|
+
"ie": "UTF-8",
|
|
129
|
+
'ppw-widgetEvent:DefaultNextPageNavigationEvent:{"nextPageKey":"key"}': "",
|
|
130
|
+
},
|
|
131
|
+
)
|
|
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
|