-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Api exposure callbacks #3347
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
Api exposure callbacks #3347
Conversation
Here is an example of how to spin up the app and how to perform the api calls: app.py
api calls
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This look like a nice feature, just need to add a docstring to the new argument and a test.
Is there another way to setup the apis rather than calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's only keep the GLOBAL_API_PATHS and use that for the registering.
dash/_callback.py
Outdated
) | ||
callback_map = _kwargs.pop("callback_map", GLOBAL_CALLBACK_MAP) | ||
callback_list = _kwargs.pop("callback_list", GLOBAL_CALLBACK_LIST) | ||
callback_api_paths = _kwargs.pop("callback_api_paths", GLOBAL_API_PATHS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's only have the global one, having two variables for the same functionality creates issue like #3419 and add complexity.
def _setup_server(self): | ||
if self._got_first_request["setup_server"]: | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's missing a call to setup_apis or is it meant to be called by the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Routes must be registered by the dev before the server is started, therefore it cant go here to automatically setup.
This PR strives to allow callbacks to be exposed by the underlying server as an API by simply passing the callback a
api_endpoint
. The api will accept a body with the functional arguments provided askwargs
.