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
I am trying to use FHIR API that returns expires_at as str but it leads to exception:
unsupported type for timedelta seconds component: str
Traceback (most recent call last):
...
File "/Users/sky/.local/share/virtualenvs/backend-hCLDLwkG/lib/python3.12/site-packages/fhirclient/client.py", line 136, in handle_callback
ctx = self.server.handle_callback(url) if self.server is not None else None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sky/.local/share/virtualenvs/backend-hCLDLwkG/lib/python3.12/site-packages/fhirclient/server.py", line 117, in handle_callback
return self.auth.handle_callback(url, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sky/.local/share/virtualenvs/backend-hCLDLwkG/lib/python3.12/site-packages/fhirclient/auth.py", line 250, in handle_callback
return self._request_access_token(server, exchange)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sky/.local/share/virtualenvs/backend-hCLDLwkG/lib/python3.12/site-packages/fhirclient/auth.py", line 287, in _request_access_token
self.expires_at = datetime.now() + timedelta(seconds=expires_in)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported type for timedelta seconds component: str
Hmm, OK - you're not wrong that we could be more graceful here, but that also doesn't look like the right type for the field. So this feels like a server error, which we could work around if we want.
Looks like you're using Athena Health - curiously, in their docs, they use a string for the "2 legged" approach, and an int for the "3 legged" approach.
I am trying to use FHIR API that returns
expires_at
as str but it leads to exception:example of API response
Right here
https://github.com/smart-on-fhir/client-py/blob/main/fhirclient/auth.py#L286
expires_in
must be converted to intexpires_in = int(ret_params.get('expires_in'))
The text was updated successfully, but these errors were encountered: