there is Facebook OAuth2 module in Tornado, but i dont get the idea behind it:
the example will get the “stream” from my wall, but because i want to see how to post on the wal using Tornado, i found a another Python module, but this one dont use the OAuth, but requires another key: a Token, and when i go to Facebook and generate it, it give me two application: the one that i created from Tornado, and the second one is “Graph API Explorer” that allowed me to generate a long key in “Extended Permission”, but i still cant post on my Facebook Wall.
Update: here is the code iused with the Python-Facebook module:
import facebook
graph=facebook.GraphAPI("____")
profile = graph.get_object("me")
graph.put_object("me", "feed", message="I am writing on my wall!")
print profile
and gives me this error:
facebook.GraphAPIError: Error validating access token: This may be because the user logged out or may be due to a system error.
Update2: it worked, it seems that i must wait a certain time to validate the save the Token in their database?
so my question is still: what is the difference between the Token and the OAuth Acces in Tornado. because am planning to use a notification everytime the application updates to Facebook Users (posting the update in the page’s wall to be seen by the users of that page)
Update3: it seems that Facebook dont allow to post more than one post by a period of time, else i got an error:
Traceback (most recent call last):
File "C:\Users\toto\Desktop\tooooooooooorfacebook.py", line 5, in <module>
graph.put_object("me", "feed", message="this is a test")
File "C:\Python27\lib\site-packages\facebook.py", line 140, in put_object
post_args=data)
File "C:\Python27\lib\site-packages\facebook.py", line 298, in request
raise GraphAPIError(response)
facebook.GraphAPIError: (#506) Duplicate status message
am sorry for asking it, now i think it got the difference:
since there is time limit to the Token, so it will be a hard task to generate it everytime by the Admin, this what Tornado do, it asks for the Token for every access, so it will get the Refreshed one.
so it gets everytime the Token.
thank you again and sorry again.