unsis
unsis

Reputation: 1

Equivalent of ServerConnection.makeRequest() on python side

I'm writing a server extension for jupyter lab and i can use ServerConnection.makeRequest() from @jupyterlab/services to send POST or GET to my custom URL in typescript. Now i want to make some request from notebook to this URL by using library requests of python but i always get 403 error.

Is there any equivalent of ServerConnection.makeRequest() in jupyter lab python library to send request to server ?

Upvotes: 0

Views: 200

Answers (1)

Balamurugan V G
Balamurugan V G

Reputation: 41

Your request from within a notebook is most likely forbidden due to the xsrf check by the jupyter server. When you start jupyter server pass the parameter --NotebookApp.disable_check_xsrf=True in the command line to disable it. Or you need to handle passing the xsrf token. Note that disabling this check in an external-facing (production) system is not recommended.

You may also have to pass or suppress token. The token can be suppressed by passing --NotebookApp.token='' when you start the server.

Upvotes: 1

Related Questions