Commit 77f8802e authored by Shrikrishna Singh's avatar Shrikrishna Singh

org/cron.py: Use dict.get method to r_json

This uses dict.get method to r_json dict and
assign '0' reviews done to the contributors whose
dict doesn't contains 'total_count' key, which
fixes the cause of 'total_count' KeyError.

Fixes #57
parent 25644f0e
Pipeline #23121764 passed with stages
in 13 minutes and 5 seconds
......@@ -25,7 +25,7 @@ def fetch_org():
contributor + '%20is:pr%20user:coala',
headers=request_headers, timeout=3000)
r_json = json.loads(response.text)
data[contributor]['reviews'] = r_json['total_count']
data[contributor]['reviews'] = r_json.get('total_count', 0)
if int(response.headers['X-RateLimit-Remaining']) == 1:
sleep(60)
......
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