Answer the question
In order to leave comments, you need to log in
'bytes' object has no attribute 'get' how to fix error?
The problem with this part of the code is writing an error when you do a return:' return sorted([Photo(photo.get('date'),
AttributeError: 'bytes' object has no attribute 'get'
def get_photos(self, uid, qty =5):
get_url = urljoin(self.BASE_URL, 'photos.get')
resp = requests.get(get_url, params={
'access_token': self.token,
'v': self.version,
'owner_id': uid ,
'album_id': 'profile',
'photo_sizes': 1,
'extended': 1
})
return sorted([Photo(photo.get('date'),
photo.get('likes')['count'],
self.find_largest(photo.get('sizes'))) for photo in resp],
key=lambda p: p.maxsize, reverse=True)[:qty]
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