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

DateTime parse error while querying word of the day #4

Open
suyashb95 opened this issue Apr 27, 2019 · 1 comment
Open

DateTime parse error while querying word of the day #4

suyashb95 opened this issue Apr 27, 2019 · 1 comment

Comments

@suyashb95
Copy link

Trace

>>> wordoftheday_api.getWordOfTheDay()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "E:\Software\Python36\lib\site-packages\wordnik\WordsApi.py", line 141, in getWordOfTheDay
    responseObject = self.apiClient.deserialize(response, 'WordOfTheDay')
  File "E:\Software\Python36\lib\site-packages\wordnik\swagger.py", line 165, in deserialize
    "%Y-%m-%dT%H:%M:%S.%f"))
  File "E:\Software\Python36\lib\_strptime.py", line 565, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "E:\Software\Python36\lib\_strptime.py", line 362, in _strptime
    (data_string, format))
ValueError: time data '2019-04-27T03:00:00' does not match format '%Y-%m-%dT%H:%M:%S.%f'

Changing line 175 in swagger.py to setattr(instance, attr, datetime.datetime.strptime(value[:-5], "%Y-%m-%dT%H:%M:%S")) seems to fix it. The same issue exists with the library for python 2.7 as well

@tortured1
Copy link

I am also having this same issue. I was able to work around it by making the following small change in swagger.py:

Line 170:

                  #                          "%Y-%m-%dT%H:%M:%S.%f"))
                                              "%Y-%m-%dT%H:%M:%S"))

thechawla225 added a commit to thechawla225/wordnik-python3 that referenced this issue Jan 12, 2022
thechawla225 added a commit to thechawla225/wordnik-python3 that referenced this issue Jan 12, 2022
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

No branches or pull requests

2 participants