Skip to content

Commit f6138e6

Browse files
author
bluepizzey
committed
Added logging for quote remaining.
1 parent d9d4aaf commit f6138e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

eridu/core.py

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def get_questions(question_ids, url=QUESTIONS_URL, filter=QUESTIONS_FILTER, acce
3131
if data.get('backoff') is not None:
3232
time.sleep(int(data.get('backoff')))
3333

34+
logger.info('Remaining quota on /questions: {}'.format(data['quota_remaining']))
35+
3436
return data
3537

3638
def get_answers(answer_ids, url=ANSWERS_URL, filter=ANSWERS_FILTER, access_key=ACCESS_KEY, site=SITE, sort=ANSWERS_SORT, order=ANSWERS_ORDER):
@@ -63,6 +65,8 @@ def get_answers(answer_ids, url=ANSWERS_URL, filter=ANSWERS_FILTER, access_key=A
6365
if data.get('backoff') is not None:
6466
time.sleep(int(data.get('backoff')))
6567

68+
logger.info('Remaining quota on /answers: {}'.format(data['quota_remaining']))
69+
6670
return data
6771

6872

@@ -85,6 +89,8 @@ def get_post_ids(page, url=POST_IDS_URL, filter=POST_IDS_FILTER, n_posts=POST_ID
8589
if data.get('backoff') is not None:
8690
time.sleep(int(data.get('backoff')))
8791

92+
logger.info('Remaining quota on /posts: {}'.format(data['quota_remaining']))
93+
8894
return data
8995

9096

0 commit comments

Comments
 (0)