geojsonio 中的 display() 给出 401 错误
display() in geojsonio gives 401 error
我正在尝试可视化一个 geojson
文件。
import geojsonio as gj
contents = open("taluk.geojson").read()
gj.display(contents)
但出现以下错误:
AuthenticationFailed Traceback (most recent call last)
<ipython-input-27-2a5e2058a16e> in <module>()
----> 1 gj.display(contents)
C:\Anaconda\lib\site-packages\geojsonio\geojsonio.py in display(contents, domain, force_gist)
34
35 """
---> 36 url = make_url(contents, domain, force_gist)
37 webbrowser.open(url)
38 return url
C:\Anaconda\lib\site-packages\geojsonio\geojsonio.py in make_url(contents, domain, force_gist, size_for_gist)
91 url = data_url(contents, domain)
92 else:
---> 93 gist = _make_gist(contents)
94 url = gist_url(gist.id, domain)
95
C:\Anaconda\lib\site-packages\geojsonio\geojsonio.py in _make_gist(contents, description, filename)
170 ghapi = github3.GitHub()
171 files = {filename: {'content': contents}}
--> 172 gist = ghapi.create_gist(description, files)
173
174 return gist
C:\Anaconda\lib\site-packages\github3\decorators.py in auth_wrapper(self, *args, **kwargs)
35 '{"message": "Requires authentication"}'
36 )
---> 37 raise error_for(r)
38 return auth_wrapper
39
AuthenticationFailed: 401 Requires authentication
它试图在 GitHub 上创建要点。我的猜测是,以前可以匿名进行此操作,但现在不行了。现在您需要进行身份验证。
需要修改的是geojsonio.py
中的_make_gist
。替换
ghapi = github3.GitHub()
来自
ghapi = github3.login('username', password='password')
我正在尝试可视化一个 geojson
文件。
import geojsonio as gj
contents = open("taluk.geojson").read()
gj.display(contents)
但出现以下错误:
AuthenticationFailed Traceback (most recent call last)
<ipython-input-27-2a5e2058a16e> in <module>()
----> 1 gj.display(contents)
C:\Anaconda\lib\site-packages\geojsonio\geojsonio.py in display(contents, domain, force_gist)
34
35 """
---> 36 url = make_url(contents, domain, force_gist)
37 webbrowser.open(url)
38 return url
C:\Anaconda\lib\site-packages\geojsonio\geojsonio.py in make_url(contents, domain, force_gist, size_for_gist)
91 url = data_url(contents, domain)
92 else:
---> 93 gist = _make_gist(contents)
94 url = gist_url(gist.id, domain)
95
C:\Anaconda\lib\site-packages\geojsonio\geojsonio.py in _make_gist(contents, description, filename)
170 ghapi = github3.GitHub()
171 files = {filename: {'content': contents}}
--> 172 gist = ghapi.create_gist(description, files)
173
174 return gist
C:\Anaconda\lib\site-packages\github3\decorators.py in auth_wrapper(self, *args, **kwargs)
35 '{"message": "Requires authentication"}'
36 )
---> 37 raise error_for(r)
38 return auth_wrapper
39
AuthenticationFailed: 401 Requires authentication
它试图在 GitHub 上创建要点。我的猜测是,以前可以匿名进行此操作,但现在不行了。现在您需要进行身份验证。
需要修改的是geojsonio.py
中的_make_gist
。替换
ghapi = github3.GitHub()
来自
ghapi = github3.login('username', password='password')