|
|
|
|
# harbor-bot
|
|
|
|
|
|
|
|
|
|
Pickleball court reservation bot for Harbor Isles Tennis & Fitness Club.
|
|
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
|
|
1. Install dependencies:
|
|
|
|
|
```bash
|
|
|
|
|
pip install -r requirements.txt
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. Configure `config.json` with your settings (see Configuration section below).
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Show configuration and next trigger times
|
|
|
|
|
python harbor_bot.py --show-config
|
|
|
|
|
|
|
|
|
|
# Test login
|
|
|
|
|
python harbor_bot.py --test-login
|
|
|
|
|
|
|
|
|
|
# Run scheduler (dry run - shows what would happen)
|
|
|
|
|
python harbor_bot.py --run
|
|
|
|
|
|
|
|
|
|
# Run scheduler (live - actually makes reservations)
|
|
|
|
|
python harbor_bot.py --run --live
|
|
|
|
|
|
|
|
|
|
# Test booking a specific court (dry run)
|
|
|
|
|
python harbor_bot.py --test-book Court_1 Saleh 2026-01-19 "19:00:00-08:00"
|
|
|
|
|
|
|
|
|
|
# Test booking a specific court (live)
|
|
|
|
|
python harbor_bot.py --test-book Court_1 Saleh 2026-01-19 "19:00:00-08:00" --live
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
|
|
The `config.json` file contains:
|
|
|
|
|
|
|
|
|
|
### API Settings
|
|
|
|
|
- `BaseAPIUrl`: API endpoint URL
|
|
|
|
|
- `CompanyId`: Club company ID
|
|
|
|
|
- `ClubId`: Club ID
|
|
|
|
|
- `AppointmentItemId`: Item ID for pickleball reservations
|
|
|
|
|
|
|
|
|
|
### Login
|
|
|
|
|
- `Username`: Your login username
|
|
|
|
|
- `Password`: Your password (stored as-is, e.g., "Goliath00!!@")
|
|
|
|
|
|
|
|
|
|
### Accounts
|
|
|
|
|
List of accounts that can be used for reservations:
|
|
|
|
|
```json
|
|
|
|
|
{"Name": "ToniB", "Id": 6964}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Courts
|
|
|
|
|
List of available courts:
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"Court": "Court_1",
|
|
|
|
|
"Id": 1,
|
|
|
|
|
"Name": "Pickleball Court - 1",
|
|
|
|
|
"ResourceTypeId": 2,
|
|
|
|
|
"AssignedResourceId": 130,
|
|
|
|
|
"IsAssignedResourceSelectable": true
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Reservation Behaviors
|
|
|
|
|
Defines how reservations are attempted:
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"Name": "Weekday_Reservation_Type",
|
|
|
|
|
"DaysInAdvance": 7,
|
|
|
|
|
"AttemptSchedule": [
|
|
|
|
|
{"Time": "04:29:00-08:00", "Attempts": 2, "DelaySeconds": 10},
|
|
|
|
|
{"Time": "04:30:00-08:00", "Attempts": 10, "DelaySeconds": 10}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Reservations
|
|
|
|
|
Scheduled reservation configurations:
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"Day": "Wednesday",
|
|
|
|
|
"Time": "19:00:00-08:00",
|
|
|
|
|
"ReservationBehavior": "Weekday_Reservation_Type",
|
|
|
|
|
"Courts": [
|
|
|
|
|
{"Court": "Court_1", "Account": "Saleh"},
|
|
|
|
|
{"Court": "Court_2", "Account": "ToniB"}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Files
|
|
|
|
|
|
|
|
|
|
- `config.json` - Main configuration
|
|
|
|
|
- `token_data.json` - Stored authentication token (auto-generated)
|
|
|
|
|
- `reservation_success.json` - Tracks successful reservations (auto-generated)
|
|
|
|
|
|
|
|
|
|
## Token Management
|
|
|
|
|
|
|
|
|
|
- Tokens are automatically saved and reused
|
|
|
|
|
- Token refresh occurs when:
|
|
|
|
|
- Token is expired
|
|
|
|
|
- Token is older than 3 days
|