Metadata-Version: 2.4
Name: rogers-api
Version: 0.1.4
Summary: Unofficial Python wrapper for Rogers Bank credit card data
Home-page: https://github.com/diogobas/rogers-api
Author: Diogo Bastos
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Requires-Dist: playwright>=1.40.0
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Rogers API (Unofficial)

Unofficial Python wrapper for Rogers Bank credit card data retrieval.

## Disclaimer

This project is not affiliated with, maintained by, or endorsed by Rogers Bank.
Automating access to banking portals may violate terms of service. Use at your own risk and only for your own account.

## MVP Goals

- HTTP-first authentication and session handling.
- Account summary retrieval.
- Credit card transaction retrieval.
- Normalized transaction output for future Lunch Money integration.

## Installation

```bash
pip install -r requirements.txt
pip install -e .
```

## Quick Start

```bash
python run.py login
python run.py discover-endpoints --capture-seconds 120
python run.py balance
python run.py transactions --start-date 2026-01-01
```

## Notes

- Credentials are requested interactively.
- Session state is stored locally and reused.
- Browser fallback is used only when direct HTTP auth cannot complete.

## Endpoint Discovery (Authenticated)

Use this command after login to capture real authenticated network calls and lock the endpoint mapping used by the client:

```bash
python run.py discover-endpoints --capture-seconds 120
```

If the sign-in button is disabled (for example due to captcha/challenge), run manual mode:

```bash
python run.py discover-endpoints --manual-login --capture-seconds 120
```

To prefer email verification and keep the browser hidden when possible:

```bash
python run.py discover-endpoints --headless --prefer-email --capture-seconds 120
```

Artifacts are written under your local session folder (`~/.rogers-api/` by default):

- `endpoint_map.json`: selected summary/transactions endpoint + HTTP method
- `endpoint-discovery-YYYYMMDD-HHMMSS.json`: raw captured XHR/fetch event metadata

### Use installed Google Chrome

By default, browser operations use Playwright's bundled Chromium. To try the
Google Chrome installed on your machine during manual login:

```bash
ROGERS_BROWSER_CHANNEL=chrome python run.py discover-endpoints --manual-login --capture-seconds 120
```

The same environment variable works for callers such as `lunchrogers`. From the
Luncheon repository root, after its Python environment has this version of
`rogers-api`, run:

```bash
ROGERS_BROWSER_CHANNEL=chrome ./lunchrogers/lunchrogers-sync.sh
```

It applies to discovery, browser authentication fallback, and browser API requests.
Library callers can also use `RogersClient(browser_channel="chrome")`; an explicit
argument takes precedence over the environment. Unset the variable or set it to
`chromium` to restore the default. Other values are rejected.

Chrome must already be installed. Launch errors are reported without silently
falling back to Chromium. This selects the browser executable, while still using
an isolated context; it does not reuse your regular Chrome profile or cookies.
It is a diagnostic option for login failures such as `ERR_401_RECAPTCHA_LOW_SCORE`,
not a guarantee that Rogers will accept the login. Complete any challenges manually.

## Publishing releases

Releases use PyPI Trusted Publishing through `.github/workflows/publish.yml`.
Configure the existing PyPI project's GitHub publisher with owner `diogobas`,
repository `rogers-api`, workflow filename `publish.yml`, and environment `pypi`.
No PyPI API token or GitHub secret is needed.

For each release, update both `setup.py` and `rogers_api/__init__.py`, merge after
CI passes, and publish a GitHub release with a matching tag (for example,
`v0.1.4`). The workflow builds and checks the wheel and sdist, verifies the
packaged versions match the tag, then publishes to PyPI. Pull requests validate
the build without publishing. Prereleases are not uploaded to PyPI.

## Dependency updates

After `.github/dependabot.yml` is merged into the default branch, Dependabot
checks Python dependencies every Monday at 07:00 in `America/Toronto`. Version
updates wait seven days after release. PRs are assigned to `diogobas`, with at
most three version-update PRs open at once. Merging remains manual.

`playwright` is kept in its own PR. Other minor/patch updates are grouped;
other major updates get separate PRs for changelog review. This repository uses
pip manifests without a lockfile, so `versioning-strategy: increase` proposes
higher minimum requirements even when the previous range allows the release.
Notifications follow GitHub account preferences. After merging an update,
refresh local environments and review any matching package metadata before
publishing a release. Updating the Git submodule pointer in Luncheon is a
separate change.


## Tests and CI

```bash
python -m pip install -r requirements.txt -e .
python -m pip check
python -m pytest -q
python run.py --help
```

CI runs on pull requests and pushes to `master` with Python 3.10 and 3.14.
It installs the requirements and package metadata from the revision being
checked, verifies dependency compatibility, runs pytest, and checks CLI help.
GitHub Actions dependencies are also monitored by Dependabot.

The suite uses temporary session/endpoint-map files and blocks unstubbed HTTP
and browser operations. Transport tests exercise requests preparation,
responses, errors, and retries with only the network send stubbed. No real
credentials, saved sessions, or installed browsers are required. Live login,
MFA, and browser behavior are outside this suite.

Requirements use minimum bounds without a lockfile. A higher minimum can
therefore resolve to the same installed release as the previous requirement.
