Troubleshooting Facebook's graph.put_object that returns error 400
Question: I am using Facebook Python's SDK along with Google App Engine, and making a
call to do a checkin:

    
    
    graph.put_object("me", "checkins", message="Hello, world", place="165039136840558", coordinates='{"latitude":"38.2454064", "longitude":"-122.0434404"}')
    

However, this throws an error 400 Bad Request and I don't seem to be able to
try catch it so I can have the important information.

On a bad request, Facebook should return, an object like below which can help
troubleshoot and address the issue, but I am not sure how I can retrieve this
object:

    
    
    {
       "error": {
        "type" : "OAuthException",
        "message" : "An active access token must be used to query information about the current user."
        }
       }
    

[Edit]

I am temporarily able to figure out the issue by: Logging the Post Data

    
    
    logging.info("LOG" + str(post_data))
    

and then using a REST client like the extension for Firefox to make the
request again. The response gives me the information I need to proceed.
However, it would have been better if I can obtain the error messages within
my app.


Answer: Like the error says, you need to create and consume an access token: Here's
some more info. Sorry I can't "comment" yet and am forced to answer.
<http://benbiddington.wordpress.com/2010/04/23/facebook-graph-api-getting-
access-tokens/>

