【发布时间】:2019-05-28 11:29:43
【问题描述】:
我想按照here 的描述在我的 Jupyter Hub 上启动笔记本服务器并开始使用,即使我遵循的基本命令也不起作用。我想使用我提到的here 的令牌发出正常请求。 我的代码是:
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()
那么,我面临一个错误,其回溯是:
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
注意:我已按照official doc 中的说明生成了令牌。我还在我的 config.yaml 文件中添加了 Jupyter Hub 不时声明的相同内容。
我无法在这种无礼的文档中找出正确的方法。
【问题讨论】:
标签: python python-requests jupyter-notebook jupyter jupyterhub