Reputation: 85
I would like to download my facebook profile picture, and there are a lot of posts here . But almost in all of them this link is given:
http://graph.facebook.com/{user_id or page_id}?fields=cover
when I run code
me?fields=cover
in API explorer it returns me an image, but when I run my link from the code:
pic_request = urllib.request.urlopen('https://graph.facebook.com/'+userID+ '?fields=cover')
it returns an error: bad request
Upvotes: 0
Views: 244
Reputation: 418
If you want to get your current profile picture:
import facebook
picture_data = graph.get_objects(ids=["me"], fields="picture")
print(picture_data)
will show something like this
{'me': {'id': '1141473373',
'picture': {'data': {'is_silhouette': False,
'url': 'https://z-p3-scontent.xx.fbcdn.net/v/t1.0-1/c21.21.259.259/s50x50/536882_4544368124211_874293187_n.jpg?oh=7e5752d39b74ac394ad4ed727cb7d47b&oe=5A7CA995'}}}}
Upvotes: 1