(lib, *, retry=0)
| 10 | |
| 11 | |
| 12 | def update_lib(lib, *, retry=0): |
| 13 | repo = lib['repo'] |
| 14 | url = f'https://api.github.com/repos/{repo}' |
| 15 | resp = session.get(url) |
| 16 | if resp.status_code == 403 and retry < 3: |
| 17 | print(f'retrying {repo} {retry}') |
| 18 | sleep(5) |
| 19 | return update_lib(lib, retry=retry + 1) |
| 20 | |
| 21 | resp.raise_for_status() |
| 22 | data = resp.json() |
| 23 | stars = data['watchers_count'] |
| 24 | print(f'{repo}: {stars}') |
| 25 | lib['stars'] = stars |
| 26 | |
| 27 | |
| 28 | with (THIS_DIR / 'using.toml').open('rb') as f: |
no test coverage detected