user706838
user706838

Reputation: 5380

How to retrieve a person's profile picture from FB with Flask?

I have already managed to get all the basic information from the user but I have no idea how to retrieve his/her profile picture.

me = facebook.get('/me?fields=id,name,first_name,last_name,age_range,link,gender,locale,timezone,updated_time,verified,friends,email')

Can you please provide some hints? I am using Python Flask and OAuth.

Upvotes: 1

Views: 793

Answers (2)

Twobard
Twobard

Reputation: 2583

Try adding 'picture' to your list of parameters

Upvotes: 3

Juan Ruiz de Castilla
Juan Ruiz de Castilla

Reputation: 974

With OAtuh and Facebook Graph you can use this, like you see this code is C# based, but you just need to check the requests URL's:

request = WebRequest.Create("https://graph.facebook.com/v2.3/me/picture?access_token=" + Uri.EscapeDataString(authorization.AccessToken));

using (var response = request.GetResponse())
{
  myImageBoxOrSomethingThatAcceptUrl.PictureUrl = response.ResponseUri.AbsoluteUri;
}

Upvotes: 1

Related Questions