我得到:错误的请求
我正在开发两个类似的 FB 应用程序。一个有效,但副本给出“错误的请求”。
Environment:
Request Method: GET
Request URL: http://doctorme.herokuapp.com/?code=AQAAWe0A6wnm24YuT066ILJMInzeJ0YPANpzb_bnS5jJRCg62KAxmTmD1m56QFVxW5DRRWRgMN8lWFNTucZpQXPHPJstRiFVPE7IfIntei-qMkNlz30SICWvfPDlfvw1g0NPBrqvkPqjZtjAF4xtR8j-WpK89ZAiMARzr3i9_GwsK6Ruhk6Zg2hqYy-qgP4CWY0
Django Version: 1.3.1
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.admindocs']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "/app/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/app/doctorme/views.py" in home
14. access_token = fbapi_auth(request)[0]
File "/app/doctorme/fbapi.py" in fbapi_auth
60. encode_func=simple_dict_serialisation)
File "/app/doctorme/fbapi.py" in fbapi_get_string
48. result = urllib2.urlopen(url).read()
File "/usr/local/lib/python2.7/urllib2.py" in urlopen
126. return _opener.open(url, data, timeout)
File "/usr/local/lib/python2.7/urllib2.py" in open
398. response = meth(req, response)
File "/usr/local/lib/python2.7/urllib2.py" in http_response
511. 'http', request, response, code, msg, hdrs)
File "/usr/local/lib/python2.7/urllib2.py" in error
436. return self._call_chain(*args)
File "/usr/local/lib/python2.7/urllib2.py" in _call_chain
370. result = func(*args)
File "/usr/local/lib/python2.7/urllib2.py" in http_error_default
519. raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
Exception Type: HTTPError at /
Exception Value: HTTP Error 400: Bad Request
I have got two similar FB apps i am working on. The one works, the copy gives 'Bad request.'
Environment:
Request Method: GET
Request URL: http://doctorme.herokuapp.com/?code=AQAAWe0A6wnm24YuT066ILJMInzeJ0YPANpzb_bnS5jJRCg62KAxmTmD1m56QFVxW5DRRWRgMN8lWFNTucZpQXPHPJstRiFVPE7IfIntei-qMkNlz30SICWvfPDlfvw1g0NPBrqvkPqjZtjAF4xtR8j-WpK89ZAiMARzr3i9_GwsK6Ruhk6Zg2hqYy-qgP4CWY0
Django Version: 1.3.1
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.admindocs']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "/app/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/app/doctorme/views.py" in home
14. access_token = fbapi_auth(request)[0]
File "/app/doctorme/fbapi.py" in fbapi_auth
60. encode_func=simple_dict_serialisation)
File "/app/doctorme/fbapi.py" in fbapi_get_string
48. result = urllib2.urlopen(url).read()
File "/usr/local/lib/python2.7/urllib2.py" in urlopen
126. return _opener.open(url, data, timeout)
File "/usr/local/lib/python2.7/urllib2.py" in open
398. response = meth(req, response)
File "/usr/local/lib/python2.7/urllib2.py" in http_response
511. 'http', request, response, code, msg, hdrs)
File "/usr/local/lib/python2.7/urllib2.py" in error
436. return self._call_chain(*args)
File "/usr/local/lib/python2.7/urllib2.py" in _call_chain
370. result = func(*args)
File "/usr/local/lib/python2.7/urllib2.py" in http_error_default
519. raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
Exception Type: HTTPError at /
Exception Value: HTTP Error 400: Bad Request
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查您在 FB 应用程序和您的应用程序之间使用了正确的配置。
尝试一下 HTTPs(即使看起来不是 HTTPs 的情况...),使用 Heroku 只需 10 秒即可启用它:)
Check you're using the right configs among FB app and your app.
Give HTTPs a shot (even if it seems not the HTTPs case...) with Heroku it's just a matter of 10secs to have it enabled :)