Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Environment variables for py_taplist
# Copy this file to .env and set your actual values

# Your Brewers Friend API key (required)
BREWERS_FRIEND_API_KEY=your_api_key_here

# Flask secret key for session management (optional, will use default if not set)
FLASK_SECRET_KEY=your_secret_key_here
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__pycache__/
*.pyc
*.pyo
*.pyd
.env
.venv
venv/
67 changes: 57 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,69 @@
You will need to install a few required libraries
## Taplist Application

A Flask-based application to display beer taplist data from Brewers Friend API with background polling for improved performance.

pip install requests flask
### Features

- **Secure API Key Management**: API keys are stored as environment variables, not in config files
- **Background Polling**: Data is fetched in the background at configurable intervals, making the UI fast and responsive
- **Admin Authentication**: Admin panel is protected with password authentication
- **Data Caching**: Beer data is cached in memory and persisted to XML files
- **Multiple Themes**: Support for different themes and styles

Run python3 taplist.py
### Installation

navigate to localhost:5000 on your favorite broswer.
You will need to install a few required libraries:

No need to edit any config files as its all down in the admin section of the site. Accessed via the gear in the top left corner.
```bash
pip install requests flask
```

### Configuration

1. **Set Environment Variables** (Recommended):
```bash
export BREWERS_FRIEND_API_KEY="your_api_key_here"
export FLASK_SECRET_KEY="your_secret_key_here" # Optional, defaults to a basic key
```

TODO
-Would like to add a password to the admin section
-add more themes
-clean up code
-clean up html and css
2. **Admin Password**: The default admin password is "admin". Change it via the admin panel after first login.

3. **Background Polling**: Data is automatically fetched from the API in the background every hour (3600 seconds) by default. This can be configured in the admin panel.

### Running the Application

```bash
python3 taplist.py
```

Navigate to `localhost:5000` in your favorite browser.

### Admin Access

- Access the admin panel via the gear icon in the top left corner
- Default admin password: `admin` (change this immediately)
- Use `/admin/logout` to log out of the admin panel

### Security Improvements

- API keys are no longer stored in config files
- Admin panel requires authentication
- Input validation on all form fields
- Secure session management
- XML output is properly escaped

### Performance Improvements

- Background polling eliminates wait times for API calls
- Data is cached in memory for instant access
- Reduced API calls through intelligent caching
- Non-blocking user interface

### TODO

- Add more themes
- Enhanced admin features
- Database integration for larger datasets



Binary file added __pycache__/taplist.cpython-312.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion beers.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version='1.0' encoding='utf-8'?>
<beers></beers>
<beers><beer><title>Test Beer</title><stylename>IPA</stylename><abv_alt>6.5</abv_alt><ibutinseth>45</ibutinseth><srmmorey>8</srmmorey><userdate>2024-01-01</userdate><id>123</id></beer></beers>
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"api_key": "Enter API key",
"title": "Enter your Title Here",
"selected_theme": "theme_one",
"selected_theme_style": "light",
"refresh_interval": "3600",
"refresh_interval": 3600,
"admin_password": "admin",
"folders": [],
"selected_folders": []
}
Loading