Hello,
I am using the code provided here to create a web2py facebook application
https://github.com/pythonforfacebook/facebook-sdk/blob/master/facebook.py
When I call this function inside of facebook.py .....
testvar = facebook.get_user_from_cookie(request.cookies, FACEBOOK_APP_ID,
FACEBOOK_APP_SECRET)
I always get this error.
'Morsel' object has no attribute 'split'
It is trying to split the signed_request variable that does exits as in
this case which was returned from facebook.
signed_request <Morsel:
fbsr_156579191121738='_idbY3Z4113pO9Z2h...CI6MTMyNzgxOTQ4MSwidXNlcl9pZCI6IjY5NzE1MTYyMiJ9'>
signed_request.split undefined
I am not sure what I am doing wrong. Any pointers or suggestions?
Ben
More details below.
Ticket ID
127.0.0.1.2012-01-29.00-45-53.cca4dcc3-0338-40d3-aaf0-e9ec6a29f163
<type 'exceptions.AttributeError'> 'Morsel' object has no attribute 'split'
Version
web2py™ (1, 99, 4, datetime.datetime(2011, 12, 14, 14, 46, 14), 'stable')
Python Python 2.6.6: /usr/bin/python
....
Traceback
File "applications/FB_Tab_App/modules/facebook.py", line 376, in
get_user_from_cookie
parsed_request = parse_signed_request(cookie, app_secret)
File "applications/FB_Tab_App/modules/facebook.py", line 395, in
parse_signed_request
l = signed_request.split('.', 2)
AttributeError: 'Morsel' object has no attribute 'split'
Error snapshot help
<type 'exceptions.AttributeError'>('Morsel' object has no attribute 'split')
......
Function argument list
(signed_request=<Morsel:
fbsr_156579191121738='_idbY3Z4113pO9Z2h...CI6MTMyNzgxOTQ4MSwidXNlcl9pZCI6IjY5NzE1MTYyMiJ9'>,
app_secret='16dc8c9503dca01b0bf3b36a41e4b43c')
.....
Code listing
....
information requested in the scope.
If the signed_request is malformed or corrupted, False is returned.
"""
try:
l = signed_request.split('.', 2)
encoded_sig = str(l[0])
payload = str(l[1])
sig = base64.urlsafe_b64decode(encoded_sig + "=" * ((4 - len(encoded_sig) %
4) % 4))
data = base64.urlsafe_b64decode(payload + "=" * ((4 - len(payload) % 4) %
4))
Variables
signed_request <Morsel:
fbsr_156579191121738='_idbY3Z4113pO9Z2h...CI6MTMyNzgxOTQ4MSwidXNlcl9pZCI6IjY5NzE1MTYyMiJ9'>
signed_request.split undefined
l undefined