Skip to content

Commit

Permalink
Applying autoformatter across projects for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdlaird committed May 4, 2024
1 parent 8fab49e commit 328600b
Show file tree
Hide file tree
Showing 20 changed files with 265 additions and 186 deletions.
97 changes: 83 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,150 +1,219 @@
# Changelog

All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/alexdlaird/amazon-orders/compare/1.1.1...HEAD)

### Added

- Documentation improvements.
- Test improvements (Amazon no longer provider the `condition` field in many cases).

### Changed
- [AmazonOrder.debug](https://amazon-orders.readthedocs.io/en/1.1.2/api.html#amazonorders.orders.AmazonOrders.debug) defaults to the value of [AmazonSession.debug](https://amazon-orders.readthedocs.io/en/1.1.2/api.html#amazonorders.session.AmazonSession.debug) if an override is not passed.

- [AmazonOrder.debug](https://amazon-orders.readthedocs.io/en/1.1.2/api.html#amazonorders.orders.AmazonOrders.debug)
defaults to the value
of [AmazonSession.debug](https://amazon-orders.readthedocs.io/en/1.1.2/api.html#amazonorders.session.AmazonSession.debug)
if an override is not passed.

## [1.1.1](https://github.com/alexdlaird/amazon-orders/compare/1.0.16...1.1.1) - 2024-04-09

### Added

- Build improvements.
- Test improvements.

### Changed

- Renamed `kwarg` passed to `IODefault.prompt()` from `captcha_img_url` to `img_url`.
- Renamed `kwarg` passed to `IODefault.prompt()` from `mfa_device_select_choices` to `choices`.

## [1.0.16](https://github.com/alexdlaird/amazon-orders/compare/1.0.15...1.0.16) - 2024-03-24

### Added
- `constants.BASE_URL` will look for the environment variable `AMAZON_BASE_URL` before defaulting to "https://www.amazon.com".

- `constants.BASE_URL` will look for the environment variable `AMAZON_BASE_URL` before defaulting
to "https://www.amazon.com".
- Build and stability improvements.

## [1.0.15](https://github.com/alexdlaird/amazon-orders/compare/1.0.14...1.0.15) - 2024-03-05

### Added

- Build and style improvements.
- Documentation improvements.
- `pytest` to streamline running unit and integration tests.

### Removed
- `conf.VERSION`, moved all version information to `amazonorders/__init__.py`. Get package version with `from amazonorders import __version__` instead.

- `conf.VERSION`, moved all version information to `amazonorders/__init__.py`. Get package version
with `from amazonorders import __version__` instead.

## [1.0.14](https://github.com/alexdlaird/amazon-orders/compare/1.0.13...1.0.14) - 2024-02-26

### Added

- Build improvements.

### Changed

- Renamed `make check-style` to `make check`.

## [1.0.13](https://github.com/alexdlaird/amazon-orders/compare/1.0.12...1.0.13) - 2024-02-20

### Added

- `login` command to CLI.
- If `--username` or `--password` are not given and no stored session, CLI will prompt.
- Build improvements.

### Fixed

- Issue where `Parsable` objects could not be pickled due to BeautifulSoup `Tag` objects.

## [1.0.12](https://github.com/alexdlaird/amazon-orders/compare/1.0.11...1.0.12) - 2024-02-11

### Added

- Relative dependency pinning in `pyproject.toml`.
- Style and stability improvements (check `flake8` with `make check-style`).

### Removed

- `requirements.txt` files to streamline in to `pyproject.toml`.

## [1.0.11](https://github.com/alexdlaird/amazon-orders/compare/1.0.10...1.0.11) - 2024-02-09

### Changed

- `version` command now includes Python version and doesn't printer banner, for easy parsing.

## [1.0.10](https://github.com/alexdlaird/amazon-orders/compare/1.0.9...1.0.10) - 2024-02-08

### Added

- Migrated to `pyproject.toml`.

## [1.0.9](https://github.com/alexdlaird/amazon-orders/compare/1.0.8...1.0.9) - 2024-02-07

### Added
- [AuthForm](https://amazon-orders.readthedocs.io/en/1.0.9/api.html#amazonorders.forms.AuthForm)'s now passes `captcha_img_url` to its `prompt()` fallback for Captcha, useful for overriding [IODefault](https://amazon-orders.readthedocs.io/en/1.0.9/api.html#amazonorders.session.IODefault).
- [MfaDeviceSelectForm](https://amazon-orders.readthedocs.io/en/1.0.9/api.html#amazonorders.forms.MfaDeviceSelectForm) now passes `mfa_device_select_choices` to `prompt()`, useful for overrides [IODefault](https://amazon-orders.readthedocs.io/en/1.0.9/api.html#amazonorders.session.IODefault).

- [AuthForm](https://amazon-orders.readthedocs.io/en/1.0.9/api.html#amazonorders.forms.AuthForm)'s now
passes `captcha_img_url` to its `prompt()` fallback for Captcha, useful for
overriding [IODefault](https://amazon-orders.readthedocs.io/en/1.0.9/api.html#amazonorders.session.IODefault).
- [MfaDeviceSelectForm](https://amazon-orders.readthedocs.io/en/1.0.9/api.html#amazonorders.forms.MfaDeviceSelectForm)
now passes `mfa_device_select_choices` to `prompt()`, useful for
overrides [IODefault](https://amazon-orders.readthedocs.io/en/1.0.9/api.html#amazonorders.session.IODefault).
- Documentation improvements.

## [1.0.8](https://github.com/alexdlaird/amazon-orders/compare/1.0.7...1.0.8) - 2024-01-30

### Added

- Stability improvements.

## [1.0.7](https://github.com/alexdlaird/amazon-orders/compare/1.0.6...1.0.7) - 2024-01-29

### Added
- [AuthForm](https://amazon-orders.readthedocs.io/en/1.0.7/api.html#amazonorders.forms.AuthForm) abstract class, and migrated all auth flow items to subclasses of this class.
- [Parsable.simple_parse()](https://amazon-orders.readthedocs.io/en/1.0.7/api.html#amazonorders.entities.parsable.Parsable.simple_parse), which can handle most basic fields when parised with CSS selectors.

- [AuthForm](https://amazon-orders.readthedocs.io/en/1.0.7/api.html#amazonorders.forms.AuthForm) abstract class, and
migrated all auth flow items to subclasses of this class.
- [Parsable.simple_parse()](https://amazon-orders.readthedocs.io/en/1.0.7/api.html#amazonorders.entities.parsable.Parsable.simple_parse),
which can handle most basic fields when parised with CSS selectors.
- Stability improvements.
- Test improvements.

### Changed

- Moved all constant variables (URLs, CSS selectors, etc.) to `constants.py`.
- Migrated entities to use CSS selector constants.
- `constants.SIGN_IN_URL` is now the landing page for login, the old value has been moved to `constants.SIGN_IN_REDIRECT_URL`.
- `constants.SIGN_IN_URL` is now the landing page for login, the old value has been moved
to `constants.SIGN_IN_REDIRECT_URL`.

## [1.0.6](https://github.com/alexdlaird/amazon-orders/compare/1.0.5...1.0.6) - 2024-01-25

### Added

- Support for when local session data is stale (Amazon prompts us to login again).
- Documentation improvements.

### Fixed

- Regression in the Captcha flow introduced in `1.0.5`.

## [1.0.5](https://github.com/alexdlaird/amazon-orders/compare/1.0.4...1.0.5) - 2024-01-25

### Added

- [Item.image_link](https://amazon-orders.readthedocs.io/en/1.0.5/api.html#amazonorders.entity.item.Item.image_link).
- [Item.quantity](https://amazon-orders.readthedocs.io/en/1.0.5/api.html#amazonorders.entity.item.Item.quantity).
- `version` command to CLI.
- Test improvements.

### Changed
- Migrated to using CSS selectors in [`AmazonSession`](https://amazon-orders.readthedocs.io/en/1.0.5/api.html#amazonorders.session.AmazonSession)
- Migrated to using CSS selectors in [`AmazonOrders`](https://amazon-orders.readthedocs.io/en/1.0.5/api.html#amazonorders.orders.AmazonOrders)

- Migrated to using CSS selectors
in [`AmazonSession`](https://amazon-orders.readthedocs.io/en/1.0.5/api.html#amazonorders.session.AmazonSession)
- Migrated to using CSS selectors
in [`AmazonOrders`](https://amazon-orders.readthedocs.io/en/1.0.5/api.html#amazonorders.orders.AmazonOrders)

## [1.0.4](https://github.com/alexdlaird/amazon-orders/compare/1.0.3...1.0.4) - 2024-01-24

### Added

- A new OTP auth flow from Amazon that can occur after Captcha.
- Parameters `--max-auth-attempts` and `--output-dir` to CLI.
- `DEFAULT_OUTPUT_DIR`, which defaults to `os.getcwd()`, but allows users to change where output files are written.
- [`Troubleshooting`](https://amazon-orders.readthedocs.io/en/1.0.4/troubleshooting.html) section to the docs.
- Test improvements, including the ability to run dynamic tests using private order data from JSON files.

### Changed
- Improved string representations of entities, including [`Order`](https://amazon-orders.readthedocs.io/en/1.0.4/api.html#amazonorders.entity.order.Order), moved string representation of all fields back to `cli.py` out of the `__str__` method.

- Improved string representations of entities,
including [`Order`](https://amazon-orders.readthedocs.io/en/1.0.4/api.html#amazonorders.entity.order.Order), moved
string representation of all fields back to `cli.py` out of the `__str__` method.
- Moved `DEFAULT_COOKIE_JAR_PATH` to `conf.py`.

## [1.0.3](https://github.com/alexdlaird/amazon-orders/compare/1.0.2...1.0.3) - 2024-01-18

### Added

- CLI improvements.
- Documentation improvements.

## [1.0.2](https://github.com/alexdlaird/amazon-orders/compare/1.0.1...1.0.2) - 2024-01-18

### Added

- `IODefault` for I/O operations, which can be extended to use something other than `print()` and `input()`.
- Documentation improvements.
- Test improvements.

### Removed
- `Orders.print_output` variable, `cli.py` now handles output.

- `Orders.print_output` variable, `cli.py` now handles output.

## [1.0.1](https://github.com/alexdlaird/amazon-orders/compare/1.0.0...1.0.1) - 2024-01-17

### Added

- Auth flow now also checks session cookies in addition to parsing the page for signs of login.
- All fields to string representation of [`Order`](https://amazon-orders.readthedocs.io/en/1.0.1/api.html#amazonorders.entity.order.Order), so they are not output on the CLI.
- All fields to string representation
of [`Order`](https://amazon-orders.readthedocs.io/en/1.0.1/api.html#amazonorders.entity.order.Order), so they are not
output on the CLI.
- `logout` command to CLI.
- Documentation improvements.
- Test improvements.

### Fixed

- Improvements to CLI, including error message cleanup on auth exceptions.
- [`Order.order_details_link`](https://amazon-orders.readthedocs.io/en/1.0.1/api.html#amazonorders.entity.order.Order.order_details_link) is now properly populated even on the details page.
- [`Order.order_details_link`](https://amazon-orders.readthedocs.io/en/1.0.1/api.html#amazonorders.entity.order.Order.order_details_link)
is now properly populated even on the details page.
- `.gitattributes` to HTML files are now ignore by Linguist.

## [1.0.0](https://github.com/alexdlaird/amazon-orders/releases/tag/1.0.0) - 2024-01-16

- First stable release of `amazon-orders`.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ for order in orders:

## Documentation

For more advanced usage, `amazon-orders`'s official documentation is available at [http://amazon-orders.readthedocs.io](http://amazon-orders.readthedocs.io).
For more advanced usage, `amazon-orders`'s official documentation is available
at [http://amazon-orders.readthedocs.io](http://amazon-orders.readthedocs.io).

## Contributing

If you would like to get involved, be sure to review the [Contribution Guide](https://github.com/alexdlaird/amazon-orders/blob/main/CONTRIBUTING.rst).
If you would like to get involved, be sure to review
the [Contribution Guide](https://github.com/alexdlaird/amazon-orders/blob/main/CONTRIBUTING.rst).

Want to contribute financially? If you've found `amazon-orders` useful, [sponsorship](https://github.com/sponsors/alexdlaird) would
Want to contribute financially? If you've found `amazon-orders`
useful, [sponsorship](https://github.com/sponsors/alexdlaird) would
also be greatly appreciated!
3 changes: 2 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

## Reporting a Vulnerability

If you suspect you have found a security vulnerability, send an email to [[email protected]](mailto:[email protected]).
If you suspect you have found a security vulnerability, send an email
to [[email protected]](mailto:[email protected]).
Please include a clear and concise description of what the vulnerability is, where it is exposed in the code, and (if
known) what best practices might apply to patching it.

Expand Down
2 changes: 1 addition & 1 deletion amazonorders/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
___ _____ _
/ _ \ | _ | | |
/ /_\ \_ __ ___ __ _ _______ _ __ | | | |_ __ __| | ___ _ __ ___
| _ | '_ ` _ \ / _` |_ / _ \| '_ \ | | | | '__/ _` |/ _ \ '__/ __|
| _ | '_ ` _ \ / _` |_ / _'_ \ | | | | '__/ _` |/ _ \ '__/ __|
| | | | | | | | | (_| |/ / (_) | | | | \ \_/ / | | (_| | __/ | \__ \\
\_| |_/_| |_| |_|\__,_/___\___/|_| |_| \___/|_| \__,_|\___|_| |___/
=======================================================================
Expand Down
2 changes: 1 addition & 1 deletion amazonorders/entity/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__license__ = "MIT"

import logging
from datetime import datetime, date
from datetime import date, datetime
from typing import Optional

from bs4 import Tag
Expand Down
4 changes: 2 additions & 2 deletions amazonorders/entity/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import json
import logging
from datetime import datetime, date
from datetime import date, datetime
from typing import List, Optional, TypeVar
from urllib.parse import urlparse, parse_qs
from urllib.parse import parse_qs, urlparse

from bs4 import BeautifulSoup, Tag

Expand Down
4 changes: 2 additions & 2 deletions amazonorders/entity/parsable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
__license__ = "MIT"

import logging
from typing import Callable, Any, Optional, Type, Union
from typing import Any, Callable, Optional, Type, Union

from bs4 import Tag

from amazonorders.constants import BASE_URL
from amazonorders.exception import AmazonOrdersError, AmazonOrderEntityError
from amazonorders.exception import AmazonOrderEntityError, AmazonOrdersError

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions amazonorders/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

from abc import ABC
from io import BytesIO
from typing import Optional, Dict, Any
from typing import Any, Dict, Optional
from urllib.parse import urlparse

from PIL import Image
from amazoncaptcha import AmazonCaptcha
from bs4 import Tag

from amazonorders import constants
from amazonorders.exception import AmazonOrdersError, AmazonOrdersAuthError
from amazonorders.exception import AmazonOrdersAuthError, AmazonOrdersError


class AuthForm(ABC):
Expand Down
6 changes: 3 additions & 3 deletions amazonorders/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
import json
import logging
import os
from typing import Optional, Any
from typing import Any, Optional
from urllib.parse import urlparse

import requests
from bs4 import BeautifulSoup, Tag
from requests import Session, Response
from requests import Response, Session
from requests.utils import dict_from_cookiejar

from amazonorders import constants
from amazonorders.conf import DEFAULT_COOKIE_JAR_PATH, DEFAULT_OUTPUT_DIR
from amazonorders.exception import AmazonOrdersAuthError
from amazonorders.forms import SignInForm, MfaDeviceSelectForm, MfaForm, CaptchaForm
from amazonorders.forms import CaptchaForm, MfaDeviceSelectForm, MfaForm, SignInForm

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion docs/_html/sitemap-index.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
>
<url>
<loc>https://amazon-orders.readthedocs.io/en/stable/</loc>
<changefreq>weekly</changefreq>
Expand Down
Loading

0 comments on commit 328600b

Please sign in to comment.