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
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 :)
精彩评论