GitHub Action daily scheduled job to fetch and save segments effort count data from strava api
To set up the project, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/segments-effort-scheduled-job.git cd segments-effort-scheduled-job
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Create a
.env
file based on the.env.example
file and fill in the required environment variables:cp .env.example .env
To add segments for a specific trail area, follow these steps:
-
Open the
segment_ids.py
file located in thesegments_data
directory. -
Locate the dictionary corresponding to the trail area you want to add segments to. For example, if you want to add segments to the "alghero" trail area, find the "alghero" dictionary.
-
Add a new entry to the dictionary with the Strava segment ID as the key and a description of the segment as the value. The description is not used by the code but can be helpful for reference.
Example:
segment_ids = {
"alghero": {
"12345678": "New Segment Description",
...
},
...
}
- Save the segment_ids.py file.
When the script runs, it will automatically add the new segment to the database under the specified trail area.
Note: Ensure that the segment ID is a valid Strava segment ID.