从目标源获取数据 https://developer.github.com/v3/activity/events/ GitHub 规定:默认每页 30 条,最多 300 条目
(page=1)
| 68 | |
| 69 | |
| 70 | def get_data(page=1): |
| 71 | """ |
| 72 | 从目标源获取数据 |
| 73 | https://developer.github.com/v3/activity/events/ |
| 74 | GitHub 规定:默认每页 30 条,最多 300 条目 |
| 75 | """ |
| 76 | |
| 77 | args = '?page={page}'.format(page=page) |
| 78 | |
| 79 | response = requests.get(API['events']+args, |
| 80 | auth=(ACCOUNT['username'], ACCOUNT['password'])) |
| 81 | status_code = response.status_code |
| 82 | if status_code == 200: |
| 83 | resp_json = response.json() |
| 84 | return resp_json |
| 85 | else: |
| 86 | logging.error('请求 event api 失败:', status_code) |
| 87 | return [] |
| 88 | |
| 89 | |
| 90 | def get_all_data(): |