Created
September 15, 2023 07:40
-
-
Save dmanchon/a0623f79ea50401ce30e97f340d986ab to your computer and use it in GitHub Desktop.
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
import requests | |
from ics import Calendar, Event | |
def main(): | |
url = "https://sitgesfilmfestival.com/ca/service/films/2023" | |
r = requests.get(url) | |
body = r.json() | |
c = Calendar() | |
for session in body["sessions"]: | |
e = Event() | |
e.name = session["name"]["en"] | |
e.begin = session["start_date"] | |
e.end = session["end_date"] | |
e.location = body["locations"][0]["name"]["es"] | |
e.uid = session["id"] | |
c.events.add(e) | |
with open('my.ics', 'w') as my_file: | |
my_file.writelines(c.serialize_iter()) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment