home / docs / sections

sections: internals:internals-datasette-is-client

This data as json

id page ref title content breadcrumbs references
internals:internals-datasette-is-client internals internals-datasette-is-client Detecting internal client requests datasette.in_client() - returns bool Returns True if the current code is executing within a datasette.client request, False otherwise. This method is useful for plugins that need to behave differently when called through datasette.client versus when handling external HTTP requests. Example usage: async def fetch_documents(datasette): if not datasette.in_client(): return Response.text( "Only available via internal client requests", status=403, ) ... Note that datasette.in_client() is independent of skip_permission_checks . A request made through datasette.client will always have in_client() return True , regardless of whether skip_permission_checks is set. ["Internals for plugins", "Datasette class", "datasette.client"] []
Powered by Datasette · Queries took 2.185ms