diff options
| author | diogo464 <[email protected]> | 2025-07-21 15:02:48 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-07-21 15:02:48 +0100 |
| commit | 8c8dabd0ed20679a2dad43a5c239f9fcfe1c1ad7 (patch) | |
| tree | 55abbcfbbff19efa3aaf6cf36540ac7651c54973 /fetch-ics | |
init
Diffstat (limited to 'fetch-ics')
| -rwxr-xr-x | fetch-ics | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fetch-ics b/fetch-ics new file mode 100755 index 000000000..0b06ddac3 --- /dev/null +++ b/fetch-ics | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | import os | ||
| 3 | import sys | ||
| 4 | import requests | ||
| 5 | |||
| 6 | for slug in sys.argv[1:]: | ||
| 7 | id_path = os.path.join("events", slug, "id") | ||
| 8 | id = open(id_path, "r").read() | ||
| 9 | ics_path = os.path.join("events", slug, "ics") | ||
| 10 | if os.path.exists(ics_path): | ||
| 11 | continue | ||
| 12 | ics_url = f"http://www.portugalrunning.com/export-events/{id}_0/" | ||
| 13 | response = requests.get(ics_url) | ||
| 14 | response.raise_for_status() | ||
| 15 | with open(ics_path, "wb") as f: | ||
| 16 | f.write(response.content) | ||
| 17 | |||
