使用Python解析JSON?

使用Python解析JSON?,python,json,git,Python,Json,Git,我正在使用GitHub API获取关于存储库上提交的JSON数据 链接到JSON文件: 我正试图获取所有致力于某个项目的用户的“id”。我该怎么做呢?现在我看到JSON文件的结构是sha/author/id 到目前为止,我的代码是: r = requests.get('https://api.github.com/repos/ErinBailey/cs399-social/commits', auth=('cs399contributions', 'contributions399')) in

我正在使用GitHub API获取关于存储库上提交的JSON数据

链接到JSON文件:

我正试图获取所有致力于某个项目的用户的“id”。我该怎么做呢?现在我看到JSON文件的结构是sha/author/id

到目前为止,我的代码是:

r = requests.get('https://api.github.com/repos/ErinBailey/cs399-social/commits', auth=('cs399contributions', 'contributions399'))

input_log = json.loads(r.text)
print(json.dumps(input_log, indent=4))
user_ids = [x for x in input_log if x['sha/commit/author/id'] > '0']
output_json = json.dumps(user_ids,indent=4)
print output_json
这是我的密码

import requests
import json

r = requests.get('https://api.github.com/repos/ErinBailey/cs399-social/commits',
                 auth=('cs399contributions', 'contributions399'))

input_log = json.loads(r.text)
user_ids = [x['committer']['id'] for x in input_log if x['committer'].get('id')]
output_json = json.dumps(user_ids, indent=4)
print output_json

我得到了以下错误:TypeError:string索引必须是输入日志中x的用户id=[x['committer']['id']上的整数(如果x['committer'])。get('id')]这与我在字典上而不是列表上进行迭代有关吗?