Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qnimbus/python-stock-checker
https://github.com/qnimbus/python-stock-checker
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/qnimbus/python-stock-checker
- Owner: QNimbus
- Created: 2024-11-07T12:38:22.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-07T12:59:32.000Z (2 months ago)
- Last Synced: 2024-11-07T13:47:39.094Z (2 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PS5 Disc Drive Stock Checker
A FastAPI application that monitors the availability of the PS5 disc drive on the PlayStation website.
## Features
- Webhook endpoint for IFTTT integration
- Web scraping to check product availability
- Debug logging
- Browser-accessible endpoint for manual checks## Installation
1. Clone the repository:
```bash
git clone https://github.com/QNimbus/python-stock-checker
cd python-stock-checker
```2. Create a virtual environment:
```bash
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
```3. Install dependencies:
```bash
pip install -r requirements.txt
```## Usage
1. Start the application:
```bash
python app.py
```2. The server will start at `http://localhost:8000`
### Available Endpoints
- GET `/check` - Check availability via browser
- POST `/webhook/check-ps5-disc-drive` - Webhook endpoint for webservices like IFTTT
- Interactive API docs available at `/docs`## Testing with external services
To test with external services, you'll need to make your local server accessible to the internet using ngrok.
You have two options:### Option 1: Using Docker (recommended)
1. Build and run the container:
```bash
docker build -t stock-checker .
docker run --name stock-checker --rm -p 8000:8000 -e NGROK_AUTH_TOKEN=your_token_here stock-checker
```The container will automatically:
- Start the FastAPI application
- Configure ngrok with your auth token
- Display the public ngrok URL
- Create a tunnel to your application### Option 2: Manual Setup
1. Sign up for a free account at https://ngrok.com/
2. Install ngrok from https://ngrok.com/download
3. Set up your authtoken (only needed once):
```bash
ngrok config add-authtoken your_auth_token_here
```4. Start ngrok (in a separate terminal):
```bash
ngrok http 8000
```## Access Points
- FastAPI app: http://localhost:8000
- FastAPI docs: http://localhost:8000/docs
- Ngrok interface: http://localhost:4040## Debugging
- Logs are written to `app.log`
- HTML content is saved to `debug_output.html` for inspection
- Visit `http://localhost:4040` to see ngrok traffic inspection## Environment Variables
Create a `.env` file in the root directory:
```env
# Add your environment variables here
```## Contributing
1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request