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
Hey,
I am using your library and everything works fine for "normal" requests.
Problem arises, when I want to call cached method from within the same service.
My route:
@router.get('/get-fiat-currency-choices')
@cache()
def get_fiat_currency_choices():
response_data = requests.get(f'{CURRENCY_EXCHANGE_API_URL}/currencies').json()
choices = []
for symbol, name in response_data.items():
choices.append(
{
'symbol': symbol,
'name': name,
}
)
return choices
I am trying to call it with:
@validator('currency')
def validate_currency(cls, val):
allowed_currencies = [currency['symbol'] for currency in get_fiat_currency_choices()]
if val not in allowed_currencies:
raise ValidationError('Currency is not supported.')
return val
Error I am getting:
RuntimeWarning: coroutine 'get_fiat_currency_choices' was never awaited
2021-08-14T17:24:37.540579531Z allowed_currencies = [currency['symbol'] for currency in get_fiat_currency_choices()]
2021-08-14T17:24:37.540585575Z RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Hey,
I am using your library and everything works fine for "normal" requests.
Problem arises, when I want to call cached method from within the same service.
My route:
I am trying to call it with:
Error I am getting:
Would appreciate any help, thanks!
P.S. The same thing occurs when I am using similar library 'fastapi-cache2' (https://github.com/long2ice/fastapi-cache)
The text was updated successfully, but these errors were encountered: