do not crash when the limitation rate is reached
This commit is contained in:
parent
3df00b6395
commit
81503a88e8
2 changed files with 13 additions and 2 deletions
|
|
@ -100,9 +100,19 @@ class TinderBrowser(APIBrowser):
|
|||
return
|
||||
|
||||
profile = self.recs.pop()
|
||||
|
||||
if 'tinder_rate_limited' in profile['_id']:
|
||||
self.logger.info(profile['bio'])
|
||||
return 600
|
||||
|
||||
resp = self.request('/like/%s' % profile['_id'])
|
||||
|
||||
if resp['match']:
|
||||
self.logger.error('Match with %s!' % profile['name'])
|
||||
else:
|
||||
self.logger.info('Liked %s (%r)' % (profile['name'], profile['common_likes']))
|
||||
|
||||
if len(self.recs) > 0:
|
||||
return 1
|
||||
else:
|
||||
return 60
|
||||
|
|
|
|||
|
|
@ -58,11 +58,12 @@ class ProfilesWalker(Optimization):
|
|||
return self._view_cron is not None
|
||||
|
||||
def view_profile(self):
|
||||
next_try = 1
|
||||
try:
|
||||
self._browser.like_profile()
|
||||
next_try = self._browser.like_profile()
|
||||
finally:
|
||||
if self._view_cron is not None:
|
||||
self._view_cron = self._sched.schedule(1, self.view_profile)
|
||||
self._view_cron = self._sched.schedule(next_try, self.view_profile)
|
||||
|
||||
|
||||
class TinderModule(Module, CapMessages, CapMessagesPost, CapDating):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue