-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calendar.search
-method with timestamp filters yielding too much
#351
Comments
Hm ... this is two issues indeed, problems with sorting and problems with the search. I will raise a separate issue for the sorting problem. |
calendar.search
-method with timestamp filters yielding too much
So you have three events marked that starts midnight MSK 2nd of December and ends midnight MSK 3rd of December (are they really stored with timestamps rather than dates in the calendar? May I see the full icalendar code?). They should not be returned because the end of the search is set to 23:59:59 at the 1st of December (I don't think the caldav standard supports milliseconds in the search timestamps). One possible reason could be that the search-code handles timezones wrongly. I don't think we have test code exercising timestamp search with timezones. Could you please try and see if it works out correctly when passing UTC timestamps? Something like this: from datetime import timezone, datetime, timedelta
start = datetime(2023,12,1,0,0,0,tzinfo=timezone.utc)
end = start + timedelta(days=1) Try with different values for start, midnight MSK is 21:00:00 UTC. Does yandex offer caldav support? Is it possible to create a yandex account dedicated for running the caldav test suite? |
Yandex calendar works using the CalDAV protocol. Your example did not change the result. Yes, you can create an account in Yandex Calendar. |
my code import logging, caldav
from caldav import Event
from datetime import datetime, UTC
logging.basicConfig(level=logging.DEBUG)
login, token = login, token
with caldav.DAVClient(url=f'https://{login}:{token}@caldav.yandex.ru') as client:
principal = client.principal()
c = principal.calendar(cal_id=cal_id)
start = datetime.now(ZoneInfo("Europe/Moscow")).replace(hour=0, minute=0, second=0)
end = start.replace(hour=23, minute=59, second=59)
print(start, end)
for e in c.search(comp_class=Event, start=start, end=end, sort_keys=("DTSTART",)):
if e.icalendar_component.get("X-TELEMOST-CONFERENCE"):
print(Conference(e.icalendar_component, "Europe/Moscow")) you can view full code in an open source project https://github.com/ArtemIsmagilov/mm-yc-notify |
I will try to register my own yandex calendar and play with it, but I cannot tell when I will get time for that. |
I should also make test code testing the search algorithm with various timezones and see if that may be an issue. Again, I cannot tell when I will get time for that. |
What I learned is that freebusy is not supported in Yandex Calendar. Also, this calendar is constantly changing some event attributes, which is why the token changes even if you don’t change the events at all. |
Unable to register account with yandex, it wants to confirm my telephone number, but the SMS doesn't get through :-( |
Result -
<Conference uid:'1o1h3lz1v41v9n4agilx3yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-02T00:00:00+03:00' dtend:'2023-12-03T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v37k5aqz0qnj5yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-02T00:00:00+03:00' dtend:'2023-12-03T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v42eaqesvjq18yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T15:03:00+03:00' dtend:'2023-12-01T15:06:00+03:00'>
<Conference uid:'1o1h3lz1v32qqkecq84p7yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T00:00:00+03:00' dtend:'2023-12-02T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v37jb80pqkwz9yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T00:00:00+03:00' dtend:'2023-12-02T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v37jdou17koz4yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T00:00:00+03:00' dtend:'2023-12-02T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v37k6id2q50t0yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-02T00:00:00+03:00' dtend:'2023-12-03T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v399c37e8i7s0yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T00:00:00+03:00' dtend:'2023-12-02T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v41v8u0b3prp6yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T00:00:00+03:00' dtend:'2023-12-02T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v32qsp1riff59yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-02T00:00:00+03:00' dtend:'2023-12-03T00:00:00+03:00'>
<Conference uid:'1o1h3lz1va12d54vfi7j4yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T09:30:00+03:00' dtend:'2023-12-01T10:00:00+03:00'>
<Conference uid:'1o1h3lz1v39az2eqax4g7yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T05:57:00+03:00' dtend:'2023-12-01T06:00:00+03:00'>
<Conference uid:'1o1h3lz1v42lol7oyhak1yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T14:53:00+03:00' dtend:'2023-12-01T15:23:00+03:00'>
<Conference uid:'1o1h3lz1v42l92t9n91k8yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T14:57:00+03:00' dtend:'2023-12-01T15:27:00+03:00'>
<Conference uid:'1o1h3lz1v421rx9uahkx9yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T13:17:00+03:00' dtend:'2023-12-01T13:18:00+03:00'>
<Conference uid:'1o1h3lz1ux74blqchq460yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T00:00:00+03:00' dtend:'2023-12-02T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v399ejhoh4em9yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-02T00:00:00+03:00' dtend:'2023-12-03T00:00:00+03:00'>
<Conference uid:'1o1h3lz1v43nqe7uk4jx6yandex.ru' timezone:Europe/Moscow dtstart:'2023-12-01T17:48:00+03:00' dtend:'2023-12-01T18:18:00+03:00' >
Problem - not sorted and wrong searching
start
andstop
The text was updated successfully, but these errors were encountered: