import vk, requests, os
session = vk.Session(access_token=access_token)
api = vk.API(session, v='5.8')
profile = api.users.get(user_id=user_id, fields=["photo_100",'sex','nickname', 'bdate'])[0]
#Записываем на диск фото с vk
data = requests.get(profile['photo_100'])
filename = os.path.join(os.getcwd()+'/static/usersdata/photos', user_id+'.jpg')
try:
f=open(filename,'wb')
f.write(data.content)
f.close()
except FileNotFoundError:
return {'errorfilewrite': True}