Metadata-Version: 2.4
Name: amazon-auth
Version: 0.2.3
Summary: Sign in to Amazon's consumer website and reuse the session from Python.
Author-email: Alex Laird <contact@alexlaird.com>
Maintainer-email: Alex Laird <contact@alexlaird.com>
License-Expression: MIT
Project-URL: Changelog, https://github.com/alexdlaird/amazon-auth/blob/main/CHANGELOG.md
Project-URL: Sponsor, https://github.com/sponsors/alexdlaird
Project-URL: Source Code, https://github.com/alexdlaird/amazon-auth
Keywords: amazon,auth,sign-in,session
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=7.1
Requires-Dist: requests>=2.23
Requires-Dist: beautifulsoup4>=4.14
Requires-Dist: PyYAML>=6.0.3
Requires-Dist: Pillow>=9.0.1
Requires-Dist: pyotp>=2.9
Provides-Extra: browser
Requires-Dist: playwright>=1.47.0; extra == "browser"
Provides-Extra: capsolver
Requires-Dist: capsolver; extra == "capsolver"
Provides-Extra: anticaptcha
Requires-Dist: anticaptchaofficial; extra == "anticaptcha"
Provides-Extra: 2captcha
Requires-Dist: 2captcha-python; extra == "2captcha"
Provides-Extra: lxml
Requires-Dist: lxml; extra == "lxml"
Provides-Extra: captcha
Requires-Dist: amazoncaptcha>=0.4; extra == "captcha"
Provides-Extra: integration
Requires-Dist: pytest-rerunfailures; extra == "integration"
Requires-Dist: parameterized; extra == "integration"
Provides-Extra: docs
Requires-Dist: Sphinx; extra == "docs"
Requires-Dist: sphinx-notfound-page; extra == "docs"
Requires-Dist: sphinx_autodoc_typehints; extra == "docs"
Requires-Dist: mypy; extra == "docs"
Requires-Dist: types-requests; extra == "docs"
Requires-Dist: types-Pillow; extra == "docs"
Requires-Dist: types-PyYAML; extra == "docs"
Requires-Dist: sphinx-sitemap; extra == "docs"
Requires-Dist: sphinxext-opengraph; extra == "docs"
Requires-Dist: furo; extra == "docs"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: coverage[toml]; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: flake8-pyproject; extra == "dev"
Requires-Dist: pep8-naming; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: types-PyYAML; extra == "dev"
Requires-Dist: types-Pillow; extra == "dev"
Requires-Dist: responses; extra == "dev"
Dynamic: license-file

<p align="center"><img alt="amazon-auth - Sign in to Amazon's consumer website from Python" src="https://amazon-auth.readthedocs.io/_images/logo.png" /></p>

[![Version](https://img.shields.io/pypi/v/amazon-auth)](https://pypi.org/project/amazon-auth)
[![Python Versions](https://img.shields.io/pypi/pyversions/amazon-auth.svg)](https://pypi.org/project/amazon-auth)
[![Coverage](https://img.shields.io/codecov/c/github/alexdlaird/amazon-auth)](https://codecov.io/gh/alexdlaird/amazon-auth)
[![Build](https://img.shields.io/github/actions/workflow/status/alexdlaird/amazon-auth/build.yml)](https://github.com/alexdlaird/amazon-auth/actions/workflows/build.yml)
[![Docs](https://img.shields.io/readthedocs/amazon-auth)](https://amazon-auth.readthedocs.io)
[![GitHub License](https://img.shields.io/github/license/alexdlaird/amazon-auth)](https://github.com/alexdlaird/amazon-auth/blob/main/LICENSE)

`amazon-auth` is an unofficial library that signs in to Amazon's consumer website (amazon.com and other Amazon sites)
and persists the session, so it can be reused from Python. It handles sign-in, OTP and MFA, challenges, and browser
sign-in. [`amazon-orders`](https://github.com/alexdlaird/amazon-orders) is built on it.

> **Note:** This package works by parsing Amazon's consumer-facing website. As Amazon provides no official API to use,
> older versions of this package may break at any time, so it's recommended that you use the latest version.

## Installation

`amazon-auth` is available on [PyPI](https://pypi.org/project/amazon-auth/) and can be installed and/or upgraded using `pip`:

```sh
pip install amazon-auth --upgrade
```

That's it! `amazon-auth` is now available as a package to your Python projects.

If pinning, be sure to use a wildcard for the [minor version](https://semver.org/) (e.g. `==0.2.*`, not `==0.2.0`) to
ensure you always get the latest stable release.

## Basic Usage

You'll use [`AmazonSession`](https://amazon-auth.readthedocs.io/api.html#amazonauth.session.AmazonSession) to sign in
to your Amazon account, then make requests with the signed-in session:

```python
from amazonauth.session import AmazonSession

amazon_session = AmazonSession("<AMAZON_EMAIL>",
                               "<AMAZON_PASSWORD>")
amazon_session.login()

response = amazon_session.get("https://www.amazon.com/gp/css/homepage.html")
print(response.parsed.title.text)
```

The most secure way to sign in is on Amazon's own page, in a browser window, so your credentials never need to be
stored (this requires the `browser` extra, `pip install amazon-auth[browser]`):

```python
from amazonauth.contrib.browser.playwright import PlaywrightBrowserLogin
from amazonauth.session import AmazonSession

amazon_session = AmazonSession()
PlaywrightBrowserLogin(amazon_session).login()
```

The session is persisted, so `AmazonSession().login()` reuses it without credentials.

## Documentation

For more advanced usage, `amazon-auth`'s official documentation is available
at [Read the Docs](https://amazon-auth.readthedocs.io).
