@@ 59,6 59,7 @@ class API(object):
'{0}: {1}'.format(data['code'], data['error'])
)
self.auth.tinder_token = data['token']
+ self.meta_update()
return models.Profile(data['user'], self)
ping = bind_api(
@@ 196,23 197,16 @@ class API(object):
if 'limit_exceeded' in data and self.debug:
log.info('X You have no available Super Likes')
- self.super_likes_remaining = \
- data['super_likes']['remaining']
- self.super_likes_allotment = \
- data['super_likes']['allotment']
- self.super_likes_resets_at = \
- data['super_likes']['resets_at']
- if self.debug:
- log.info('* Super Likes Remaining: {0} (out of {1})'.format(
- self.super_likes_remaining,
- self.super_likes_allotment,
- ))
+ self.update_likes_remaining(data)
return data.get('match', False)
- def update_likes_remaining(self):
+ def meta_update(self):
data = self.meta()
+ self.update_likes_remaining(data['rating'])
+
+ def update_likes_remaining(self, data):
try:
- self.likes_remaining = data['rating']['likes_remaining']
+ self.likes_remaining = data['likes_remaining']
if self.debug:
log.info('* Likes Remaining: {0}'.format(self.likes_remaining))
except (KeyError, TypeError):
@@ 220,11 214,11 @@ class API(object):
try:
self.super_likes_remaining = \
- data['rating']['super_likes']['remaining']
+ data['super_likes']['remaining']
self.super_likes_allotment = \
- data['rating']['super_likes']['allotment']
+ data['super_likes']['allotment']
self.super_likes_resets_at = \
- data['rating']['super_likes']['resets_at']
+ data['super_likes']['resets_at']
if self.debug:
log.info('* Super Likes Remaining: {0} (out of {1})'.format(
self.super_likes_remaining,