question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fastapi function check too strict

See original GitHub issue

I want to use fastapi with callables which return False on a inspect.is_function check.

from fastapi import FastAPI
import toolz

def some_function():
    ...

def error_handler():
    ...

endpoint = toolz.excepts(Exception, some_function, error_handler)
app = FastAPI()
app.get("/")(endpoint)

Result:

AssertionError: An endpoint must be a function or method

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
urivacommented, Nov 30, 2019

Yeah it’s just an example, functools.partial and I guess toolz.compose don’t work either.

0reactions
github-actions[bot]commented, Feb 23, 2020

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Query Parameters and String Validations - FastAPI
As we have to replace the default value None in the function with Query() ... This specific regular expression checks that the received...
Read more >
FastAPI - The Good, the Bad and the Ugly - Infolytx
To do exception handling in FastAPI, you simply have to use @app.exception_handler annotation or app.add_exception_handler function to register the response for ...
Read more >
4 Useful Advanced Features in FastAPI | by Ng Wai Foong
Moreover, I have covered two FastAPI tutorials on How to Migrate From Flask ... Event handlers — Register functions to be executed when...
Read more >
FastAPI runs api-calls in serial instead of parallel fashion
Thus, if your function is not going to make any async calls, ... Note: When you call your endpoint for the second (third,...
Read more >
FastAPI Tips & Tricks: Testing a Database - DEV Community ‍ ‍
But if like me, you come from Django, you might still struggle to configure everything so that each test works in isolation, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found