Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve error handling #41

Merged
merged 1 commit into from
Jan 4, 2023
Merged
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
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,25 @@ Pirkkabot innocently scans K-Ruoka webstore for Pirkka III -beer's price daily.
- BeautifulSoup :)
- ScrapeOps

# Run Pirkkabot
## Run Pirkkabot

To run Pirkkabot, populate secrets, run:
To run Pirkkabot, populate ScrapeOps API key, run:

```shell
pipenv shell
python3 ./check_price.py
```

### PirkkaDB
## PirkkaDB

As of v1.0.1 Pirkka III-Olut daily price is saved to an SQLite database.
Database backups are handled at the server backend to the off-site NAS server.

## Contributing

If you wish to contribute to Pirkkabot, please create a pull request with a description of your feature/bug fix.

Some things on the to do list are;

- Vercel hosted API that returns price on /api/price GET
- Drawing graph on the price data
6 changes: 5 additions & 1 deletion check_price.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is used as a debugging script to test the price scraping function

import requests
from datetime import date
Expand All @@ -19,7 +20,10 @@ def define_price():
)
soup = BeautifulSoup(response.content, 'html.parser')
price = soup.find('span', class_='price')
return price
if price is None:
raise ValueError('Price is None')
else:
return price

while True:
try:
Expand Down