[英]python-instagram 500 Internal server error
When attempting to run the sample program from https://github.com/Instagram/python-instagram 尝试从https://github.com/Instagram/python-instagram运行示例程序时
Everything works fine until I try to click on any of the links that are running on my http://localhost:8515/ . 一切正常,直到我尝试单击http:// localhost:8515 /上运行的任何链接。 I can successfully login, but if I click any of the links like "User Recent Media" I get the following error:
我可以成功登录,但是如果单击“用户最新媒体”之类的任何链接,都会出现以下错误:
KeyError('access_token',)
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/bottle.py", line 862, in _handle
return route.call(**args)
File "/usr/local/lib/python3.4/site-packages/bottle.py", line 1732, in wrapper
rv = callback(*a, **ka)
File "sample_app.py", line 75, in on_recent
access_token = request.session['access_token']
File "/usr/local/lib/python3.4/site-packages/beaker/session.py", line 672, in __getitem__
return self._session()[key]
KeyError: 'access_token'
I am running Python3.4 on OSX Yosemite. 我在OSX Yosemite上运行Python3.4。 My Instgram client uses the following URI and website:
我的Instgram客户端使用以下URI和网站:
The problem that you have here is that in your sample.py you are trying to access to access_token in the request.session dictionary and it doesn't exists. 这里的问题是在sample.py中,您尝试访问request.session词典中的access_token,但它不存在。 To avoid the error you can do something like:
为了避免该错误,您可以执行以下操作:
if 'access_token' in request.session.keys():
access_token = request.session['access_token']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.