Other files

This commit is contained in:
2026-04-10 18:30:04 -04:00
parent ea4ddd7d41
commit bcbfe2797c
17 changed files with 2221 additions and 16 deletions
+50
View File
@@ -135,3 +135,53 @@ python src/discord_bot.py
```bash
python -m pytest tests/
```
## Auto-Buy System
### Architecture
- `src/buyers/base_buyer.py` — Abstract base, browser launch, shared utilities
- `src/buyers/target_buyer.py` — Target checkout flow
- `src/buyers/bestbuy_buyer.py` — BestBuy checkout flow
- `src/buyers/gamestop_buyer.py` — GameStop checkout flow (Selenium)
- `src/profile_store.py` — AES-256 encrypted user checkout profiles
- `data/browser_states/<user_id>/<site>.json` — Saved browser sessions per user
### Multi-User Browser Session Setup (Target)
Target blocks automated logins with a server-side error. Each user must save a browser session once by logging in manually. Sessions are stored per-user per-site.
**One-time setup per user:**
```bash
# User 1 logs into Target
python test_buy.py --setup target --user-id 1
# User 2 logs into Target
python test_buy.py --setup target --user-id 2
```
A Chrome window opens on the Target account page. The user logs in normally, then presses Enter in the terminal. Session saved to `data/browser_states/<user_id>/target.json`.
**Sessions expire** when the Target login cookie expires (typically 3090 days). Re-run `--setup` for that user if checkout starts failing.
**The same pattern applies to BestBuy and GameStop:**
```bash
python test_buy.py --setup bestbuy --user-id 1
python test_buy.py --setup gamestop --user-id 1
```
### Dry-Run Testing
```bash
# Non-interactive (set TEST_USER_ID and TEST_PROFILE_PASSWORD in .env)
python test_buy.py target https://www.target.com/p/...
# Interactive (prompts for user selection and profile password)
python test_buy.py target https://www.target.com/p/...
```
### Enabling Real Purchases
In `config.py`:
```python
AUTO_BUY_ENABLED = True
AUTO_BUY_DRY_RUN = False # default True — must explicitly disable
AUTO_BUY_MAX_PRICE = 60.00 # price ceiling per item
```