Answer the question
In order to leave comments, you need to log in
How to get avatar url in python-social-auth?
Good afternoon.
I made a custom pipline to save avatars of users who log in through social networks.
For example:
def save_profile(backend, user, response, *args, **kwargs):
if isinstance(backend, VKOAuth2):
if not user.avatar:
url = response['photo']
try:
response = request('GET', url)
response.raise_for_status()
except ConnectionError:
pass
else:
user.avatar.save(u'',
ContentFile(response.content),
save=False
)
user.save()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question