alexdlaird / amazon-orders

A CLI and library for interacting with Amazon order history
https://amazon-orders.readthedocs.io
MIT License
23 stars 9 forks source link

Avoid reporting parse_return_eligible_date errors #24

Closed mkhazhinsky closed 1 month ago

mkhazhinsky commented 1 month ago

Acknowledgements

Describe the Feature

For some orders parsing return eligible dates fail with the following error:

When building Item, return_eligible_date could not be parsed. Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/amazonorders/entity/parsable.py", line 51, in safe_parse return parse_function(**kwargs) File "/usr/local/lib/python3.10/dist-packages/amazonorders/entity/item.py", line 80, in _parse_return_eligible_date value = datetime.strptime(date_str, "%b %d, %Y").date() File "/usr/lib/python3.10/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/usr/lib/python3.10/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data 'November 9, 2024\n\n\n\n$27.99$27.99\n\n\n\n\n\n\n\n\n\nBuy it again\n\n\n \n \n \n View your item' does not match format '%b %d, %Y'

The error seems to happen for all subscription items, like the one in the attached example. It has an additional line "Auto-delivered: Every 3 months"

order-details_0 - Copy.zip

Describe Alternative Solutions/Workarounds

No response

alexdlaird commented 1 month ago

This is due to a new tagging mechanism Amazon appears to be rolling out in the last couple weeks. It will eventually make parsing the pages a lot easier, but right now it's a but of a manual process to see what the new tags look like. Thanks for the example, I'll get this fixed!

alexdlaird commented 1 month ago

Fixed in 2.0.3. Thanks!

mkhazhinsky commented 4 weeks ago

Thank you