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.

0 Answers