Files
pcs_live/README.md

42 lines
1.1 KiB
Markdown

# pcs_live
scrapes procyclingstats livestats homepage and timeline
# todo
- [x] timeline items with details
- [ ] pypi package ??
# setup (windows)
after cloning set up a virtualenv
```
py -3 -m venv .venv
.venv\Scripts\activate
```
if you get an error while activating the virtualenv, you may need to run this first
```
Set-ExecutionPolicy Unrestricted -Force
```
install dependencies
```
pip install beautifulsoup4
pip install requests
```
# examples
in any looping example, use a suitable delay to avoid spamming the site with requests
`example_latest_timeline.py` : uses a simple infinite loop (async would be better in a full application) to skim the top of the timeline for live updates. it will not display the same update twice
`example_live_timeline.py` : another older way to show a live timeline update, less compatible with async routines due to the checking of the last item
`example_situation.py` : display the provided time gaps (if any) in a readable format
`example_timeline_all.py` : display the entire timeline of a race (at this moment) - in reverse so that the latest update is at the bottom for console convenience