You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 8, 2026. It is now read-only.
I think we should require the timezone information, so we can make a correct conversion. I don't think we have that many (if any) users of this client yet, so we won't be breaking anyones expectations.
Is it a lot of work to use date and time with timezone information in Python? Hmm... we also want it to be easy to use the client, but by requiring timezone info we might make it harder.
Yeah, that seems good too, looks like that's what django uses. I guess these library creates general Python objects so the user could choose to use any of them?
Activity
roback commentedon Feb 22, 2016
Python has two "types" of datetime objects, one with and one without timezone information. The one without timezone seems to be the default:
How should we treat datetimes without timezone? Issue a warning and interpret it as UTC?
dentarg commentedon Feb 22, 2016
I think we should require the timezone information, so we can make a correct conversion. I don't think we have that many (if any) users of this client yet, so we won't be breaking anyones expectations.
dentarg commentedon Feb 22, 2016
This is kinda strange though
Is it a lot of work to use date and time with timezone information in Python? Hmm... we also want it to be easy to use the client, but by requiring timezone info we might make it harder.
roback commentedon Feb 22, 2016
I think the first of my tests above is weird too. I explicitly added
UTCto the date, but.tzinfoisNone.dentarg commentedon Feb 22, 2016
https://docs.python.org/2/library/datetime.html#datetime.tzinfo is a good read
Good distinction. Now on to how to use it...
datetime.now([tz])can take "an instance of a classtzinfosubclass" as argument......but it seems like you have to create that class yourself, see examples at https://docs.python.org/2/library/datetime.html#tzinfo-objects. So it seems like you have to work a bit.
http://stackoverflow.com/questions/17976063/how-to-create-tzinfo-when-i-have-utc-offset suggests
Could be worth looking into. Perhaps it's enough having examples using dateutil.
dentarg commentedon Feb 22, 2016
And our tests :)
roback commentedon Feb 22, 2016
I saw that
pytzwas mentioned in a few places too.dentarg commentedon Feb 22, 2016
Yeah, that seems good too, looks like that's what django uses. I guess these library creates general Python objects so the user could choose to use any of them?
roback commentedon Feb 22, 2016
We have to add one of the above packages as a dependency since we should include the timezone in
Post#publishedandPost#indexed:twingly-search-api-python/twingly_search/post.py
Lines 44 to 45 in 23445a4
dentarg commentedon Feb 22, 2016
Yeah, that's true.
Convert Query#start_time and #end_time to UTC