plaid / plaid-python

Python bindings for Plaid
https://plaid.com/docs
MIT License
422 stars 147 forks source link

Fastapi is not able to convert create_link_token method return into jsonable object #515

Closed akshaybhuradia29 closed 4 months ago

akshaybhuradia29 commented 4 months ago

Hi,

I am using python-plaid with fastapi. Consuming library method like

_response = plaid_client.link_token_create(request, async_req=True)
result = _response.get()
return result

when ever i hit endpoint with above for create link token i get error :

File "/home/aky/.local/share/virtualenvs/acc-du_aOwwS/lib/python3.11/site-packages/fastapi/encoders.py", line 303, in jsonable_encoder jsonable_encoder( File "/home/aky/.local/share/virtualenvs/acc-du_aOwwS/lib/python3.11/site-packages/fastapi/encoders.py", line 333, in jsonable_encoder return jsonable_encoder( ^^^^^^^^^^^^^^^^^ File "/home/aky/.local/share/virtualenvs/acc-du_aOwwS/lib/python3.11/site-packages/fastapi/encoders.py", line 289, in jsonable_encoder encoded_value = jsonable_encoder( ^^^^^^^^^^^^^^^^^ File "/home/aky/.local/share/virtualenvs/acc-du_aOwwS/lib/python3.11/site-packages/fastapi/encoders.py", line 332, in jsonable_encoder raise ValueError(errors) from e ValueError: [TypeError("'_thread.RLock' object is not iterable"), TypeError('vars() argument must have dict attribute')]

phoenixy1 commented 4 months ago

This appears to be related to an incorrect calling pattern for async requests with FastAPI, without using await. See https://stackoverflow.com/questions/72611531/adding-async-to-fastapi-function-gives-me-the-coroutine-object-is-not-iterabl

Closing as this does not appear related to the Plaid API.