python web.py 404_urllib2.HTTPError:HTTP错误404:未找到

My Error Message when running my python scripts using a raspberry pi

Traceback (most recent call last):>Traceback (most recent call last):

File "test.py", line 6, in (module)

import appengineauth

File "/home/pi/Downloads/google_appengine/appengineauth.py", line 30, in (module)

auth_resp = urllib2.urlopen(auth_req)

File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen

return opener.open(url, data, timeout)

File "/usr/lib/python2.7/urllib2.py", line 437, in open

response = meth(req, response)

File "/usr/lib/python2.7/urllib2.py", line 550, in http_response

'http', request, response, code, msg, hdrs)

File "/usr/lib/python2.7/urllib2.py", line 475, in error

return self._call_chain(*args)

File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain

result = func(*args)

File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default

raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)

urllib2.HTTPError: HTTP Error 404: Not Found

I'm able to access the website. Not too sure what is the actual problem.

解决方案

If you're using https://github.com/adafruit/Tweet-a-Watt/blob/master/appengineauth.py (you don't tell us where you got your appengineauth.py from, thus forcing us to guess), and its line

auth_uri = 'https://www.google.com/accounts/ClientLogin'

then you're likely running into the deprecation documented at https://developers.google.com/identity/protocols/AuthForInstalledApps , and I quote:

Important: ClientLogin has been officially deprecated since April 20, 2012 and is now no longer available. Requests to ClientLogin will fail with a HTTP 404 response. We encourage you to migrate to OAuth 2.0 as soon as possible.

I.e, the 404 you're getting would then be exactly the symptom the warning tells you about, now that ClientLogin has been removed, more than 3.5 years after the original deprecation warning.

Not sure how best to connect your Raspberry Pi to App Engine (or any other Google service requiring authentication) with OAuth 2.0 (since ClientLogin is not an option any more). http://guy.carpenter.id.au/gaugette/2012/11/06/using-google-oauth2-for-devices/ (written shortly after the deprecation but smartly avoiding reliance on the already-deprecated ClientLogin service) recommends an "OAuth2 for Devices" library and summarizes how to use it; I haven't tried that library myself (and I don't have a Raspberry Pi to try it on) but it does seem like a potentially fruitful avenue for you to explore.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值