【发布时间】:2017-05-10 18:24:38
【问题描述】:
我遇到了一个错误,在这里找到的所有类似答案都没有帮助我。
我得到一个
HTTPError:HTTP 错误 400:错误请求
当我尝试执行 Delete.py 文件的下一行代码时
def DeleteFBUser(idSocial):
url = 'https://graph.facebook.com/{}/permissions&access_token={}'
url = url.format(idSocial, FBToken)
req = urllib2.Request(url)
req.get_method = lambda: 'DELETE'
response = urllib2.urlopen(req)
这就是完整的 Traceback
Traceback (most recent call last):
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/apps/e~gold-circlet-160109/20170510t200435.401160541821948379/Delete.py", line 12, in dispatch
webapp2.RequestHandler.dispatch(self)
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/e~gold-circlet-160109/20170510t200435.401160541821948379/Delete.py", line 27, in get
FBLogin.DeleteFBUser(idSocial=self.session["ECommerceUser"]["idSocial"])
File "/base/data/home/apps/e~gold-circlet-160109/20170510t200435.401160541821948379/FBLogin.py", line 46, in DeleteFBUser
response = urllib2.urlopen(req)
File "/base/data/home/runtimes/python27_experiment/python27_dist/lib/python2.7/urllib2.py", line 158, in urlopen
return opener.open(url, data, timeout)
File "/base/data/home/runtimes/python27_experiment/python27_dist/lib/python2.7/urllib2.py", line 439, in open
response = meth(req, response)
File "/base/data/home/runtimes/python27_experiment/python27_dist/lib/python2.7/urllib2.py", line 552, in http_response
'http', request, response, code, msg, hdrs)
File "/base/data/home/runtimes/python27_experiment/python27_dist/lib/python2.7/urllib2.py", line 477, in error
return self._call_chain(*args)
File "/base/data/home/runtimes/python27_experiment/python27_dist/lib/python2.7/urllib2.py", line 411, in _call_chain
result = func(*args)
File "/base/data/home/runtimes/python27_experiment/python27_dist/lib/python2.7/urllib2.py", line 560, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 400: Bad Request
有什么想法吗?
【问题讨论】:
标签: python-2.7 http google-app-engine urllib2