I'm trying to figure out, how to log in to facebook account and get access token so I can post into my groups.
To create a GraphAPI
instance, I need to check access_token which I need and put it into the code.
I'm curious whether is it possible to use username and password to get the access_token
automatically so the program can be used by more users.
oauth_access_token = 'ACCESS TOKEN WHICH I HAVE TO GET FROM http://ift.tt/1baC4nV'
def post_to_1_group(user,password,post):
graph = facebook.GraphAPI(oauth_access_token)
groups = graph.get_object("me/groups")
group_id = groups['data'][1]['id'] # select the first group I'm in
graph.put_object(group_id, "feed", message=post)
This code works but it doesn't use user
and password
arguments. I have to check my access_token everytime I want to run the program.
Is it possible?
Aucun commentaire:
Enregistrer un commentaire