class VkSource AbstractSource last_query_time def recall function def

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
class VkSource(AbstractSource):
last_query_time = 0
def recall(function):
def make(self):
try:
return function(self)
except vkontakte.VKError as e:
if str(e.code) == '6':
return function(self)
return make
@recall
def get_friends_info(self, user_id):
for friend in self.call_with_pagination('friends.get', user_id=user_id, fields='photo_200', order='name'):
if not friend.get('photo_200'):
friend['photo_200'] = 'http://vk.com/images/camera_a.gif'
yield friend