pull/83/head
Thomas Irgang 2021-09-08 22:42:37 +02:00
rodzic 41f287eb52
commit f7caa0a5b8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A22645F70DA20ADE
1 zmienionych plików z 50 dodań i 0 usunięć

Wyświetl plik

@ -31,6 +31,56 @@ Google:
es = events(<Google Calendar URL>)
Example
=======
see main.py
.. code:: python
from icalevents.icalevents import events_async, latest_events, all_done
from time import sleep
if __name__ == '__main__':
keys = []
with open('calendars.txt', mode='r', encoding='utf-8') as f:
counter = 1
while True:
line = f.readline()
if not line:
break
name, url = line.split(maxsplit=1)
name = name.strip()
url = url.strip()
fix_apple = False
if name == 'icloud':
fix_apple = True
key = "req_%d" % counter
counter += 1
keys.append(key)
events_async(key, url, fix_apple=fix_apple)
while keys:
print("%d request running." % len(keys))
for k in keys[:]:
if all_done(k):
print("Request %s finished." % k)
keys.remove(k)
es = latest_events(k)
for e in es:
print(e)
sleep(2)
API
===