forked from isaac-chung/strava-kudos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add session logic
- Loading branch information
Showing
6 changed files
with
73 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,16 @@ | ||
# Strava Kudos Giver 👍👍👍 | ||
|
||
[![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/) ![Build](https://github.com/isaac-chung/strava-kudos/actions/workflows/build.yml/badge.svg) [![Give Strava Kudos](https://github.com/isaac-chung/strava-kudos/actions/workflows/give_kudos.yml/badge.svg)](https://github.com/isaac-chung/strava-kudos/actions/workflows/give_kudos.yml) | ||
Originally from [isaac-chung](https://github.com/isaac-chung/strava-kudos) which supports an run env via github workflows. Modified to run via systemd timer locally on a server. | ||
|
||
A Python tool to automatically give [Strava](https://www.strava.com) Kudos to recent activities on your feed. There are a few repos that uses JavaScript like [strava-kudos-lambda](https://github.com/mjad-org/strava-kudos-lambda) and [strava-kudos](https://github.com/rnvo/strava-kudos). | ||
|
||
The repo is set up so that the script runs on a set schedule via Github Actions. Github suggests in their [docs](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule) to not run cron jobs at the start of every hour to avoid delays so minute30 was chosen here. Feel free to change it to whenever you want. There is also a `max_run_duration` parameter which is 9 minutes by default so that we don't exceed the [monthly Github Action free tier minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes) when the action is triggered a few times a day. | ||
|
||
## 🏃 Usage | ||
1. Fork the repo | ||
2. Setup the environment variables in secrets | ||
3. Give kudos automatically! | ||
|
||
Alternatively, you can run the script manually with | ||
``` | ||
python3 give_kudos.py | ||
``` | ||
|
||
## 🛠️Setup | ||
|
||
### Playwright | ||
[Playwright](https://github.com/microsoft/playwright-python) is used, so be sure to follow instructions to install it properly. | ||
|
||
### Environment Variables | ||
|
||
Set the environment variables for your email and password as follows: | ||
``` | ||
export STRAVA_EMAIL=YOUR_EMAIL | ||
export STRAVA_PASSWORD=YOUR_PASSWORD | ||
``` | ||
|
||
### Github Actions | ||
To add secrets for GH actions, navigate to Settings -> Security -> Secrets and Variables -> Actions. Enter your email and password within `Repository Secrets`. | ||
|
||
|
||
## Contributions | ||
Let me know if you wish to add anything or if there are any issues :) | ||
|
||
[![ForTheBadge built-with-love](http://ForTheBadge.com/images/badges/built-with-love.svg)](https://GitHub.com/Naereen/) | ||
2. Setup pyenv and/or install playwright | ||
3. Fill strava credentials inside env file | ||
4. Adjust paths in service file | ||
5. Copy service/timer to /etc/systemd/system | ||
6. `systemctl daemon-reload` | ||
7. `systemctl enable --now give_kudos.timer` | ||
8. Give kudos automatically! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
STRAVA_EMAIL=example@example.com | ||
STRAVA_PASSWORD=VerySecurePassword11elf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[Unit] | ||
Description=Strava give kudos | ||
|
||
[Service] | ||
Type=oneshot | ||
WorkingDirectory=/path/to/clone/dir | ||
EnvironmentFile=/path/to/clone/dir/give_kudos.env | ||
ExecStart=/path/to/python give_kudos.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=Strava kudos timer | ||
|
||
[Timer] | ||
OnCalendar=8..21:0/15 | ||
RandomizedDelaySec=15min | ||
Persistent=true | ||
|
||
[Install] | ||
WantedBy=timers.target |
Empty file.