0

I want to start a notebook server on my Jupyter Hub as described here and to get started, even the basic command that I am following is not working. I want to make a normal request using my token as mentioned here. My code is:

import requests
token = "aa36d53a8cb5473a9e7ee07b1f3d8a49"
api_url = 'http://<some_no>.ap-south-1.elb.amazonaws.com/hub/api'
r = requests.get(api_url + '/users', headers={ 'Authorization': 'token %s' % token, } )
r.raise_for_status()

I, then, face an error, traceback of which is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://<some_no>.ap-south-1.elb.amazonaws.com/hub/api/users

Note: I have generated the token as described in the official doc. I also added the same in my config.yaml file that Jupyter Hub states every now and then.

I am unable to figure out the correct way in such ill-mannered documentation.

Aviral Srivastava
  • 4,058
  • 8
  • 29
  • 81

1 Answers1

0

Maybe there is a problem with your instance firewall configuration? Do you enable HTTP/HTTPS traffic?

To check if api is working, you can use endpoint which dont need authentication: http://<some-ip>/hup/api it should return the JupyterHub version.

pplonski
  • 5,023
  • 1
  • 30
  • 34