Skip to content
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

Incremental API does not work, when passing datetime.datime #590

Closed
srusskih opened this issue Sep 19, 2023 · 6 comments · Fixed by #591
Closed

Incremental API does not work, when passing datetime.datime #590

srusskih opened this issue Sep 19, 2023 · 6 comments · Fixed by #591

Comments

@srusskih
Copy link

srusskih commented Sep 19, 2023

Lib version: 2.0.39

Looks like we need to import datetime.datetime here https://github.com/facetoe/zenpy/blob/master/zenpy/lib/util.py#L2

>>> from zenpy.lib import util
>>> from datetime import datetime  
>>> util.to_unix_ts(datetime.utcnow())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "..... /.venv/lib/python3.10/site-packages/zenpy/lib/util.py", line 26, in to_unix_ts
    if isinstance(start_time, datetime):
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union
>>> util.json_encode(datetime.utcnow(), None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sr/projects/SpeechEngine/backend/app/.venv/lib/python3.10/site-packages/zenpy/lib/util.py", line 139, in json_encode
    elif isinstance(obj, datetime):
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

@srusskih srusskih changed the title Incremental API does not works when passing datetime.datime Incremental API does not work, when passing datetime.datime Sep 19, 2023
@cryptomail
Copy link
Collaborator

Interesting, there was some movement around that, and the tests passed....I will analyze and fix

@cryptomail
Copy link
Collaborator

Look what I did.
Previous:

from datetime import datetime, date

Post:
from datetime import date

I'm a bad person. Adding back. Please hold.

@cryptomail
Copy link
Collaborator

cryptomail commented Sep 19, 2023

BTW I'm not trying to make and build my own economy here. Please post your code that breaks this so I can add a test.
Well I guess you have, kind of.

@cryptomail
Copy link
Collaborator

ok, quickly fixing as I've replicated and will push now.

cryptomail added a commit that referenced this issue Sep 19, 2023
@cryptomail
Copy link
Collaborator

Added test @srusskih not released yet but it's in mainline

@srusskih
Copy link
Author

@cryptomail Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants