Commit d7d7327d by Chris Rossi Committed by Diana Huang

Allow force checking, disregarding LinkedIn's rules.

parent dffa8c66
...@@ -34,7 +34,6 @@ def get_call_limits(): ...@@ -34,7 +34,6 @@ def get_call_limits():
Use 80 emails per API call and 1 call per second. Use 80 emails per API call and 1 call per second.
""" """
return -1, 80, 1
now = timezone.now().astimezone(pytz.timezone('US/Pacific')) now = timezone.now().astimezone(pytz.timezone('US/Pacific'))
lastfriday = now lastfriday = now
while lastfriday.weekday() != FRIDAY: while lastfriday.weekday() != FRIDAY:
...@@ -63,7 +62,14 @@ class Command(BaseCommand): ...@@ -63,7 +62,14 @@ class Command(BaseCommand):
dest='recheck', dest='recheck',
default=False, default=False,
help='Check users that have been checked in the past to see if ' help='Check users that have been checked in the past to see if '
'they have joined or left LinkedIn since the last check'),) 'they have joined or left LinkedIn since the last check'),
make_option(
'--force',
action='store_true',
dest='force',
default=False,
help='Disregard the parameters provided by LinkedIn about when it '
'is appropriate to make API calls.'))
def handle(self, *args, **options): def handle(self, *args, **options):
""" """
...@@ -71,9 +77,13 @@ class Command(BaseCommand): ...@@ -71,9 +77,13 @@ class Command(BaseCommand):
""" """
api = LinkedinAPI() api = LinkedinAPI()
recheck = options.pop('recheck', False) recheck = options.pop('recheck', False)
max_checks, checks_per_call, time_between_calls = get_call_limits() force = options.pop('force', False)
if not max_checks: if force:
raise CommandError("No checks allowed during this time.") max_checks, checks_per_call, time_between_calls = -1, 80, 1
else:
max_checks, checks_per_call, time_between_calls = get_call_limits()
if not max_checks:
raise CommandError("No checks allowed during this time.")
def batch_users(): def batch_users():
"Generator to lazily generate batches of users to query." "Generator to lazily generate batches of users to query."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment