import requests

# 执行API调用并存储响应
url = 'https://api.github.com/search/repositories?&q=language:python&sort=stars'
headers = {'Accept': 'application/vnd.github.v3+json'}
r = requests.get(url, headers=headers)
print(f"status code = {r.status_code}")

# 将api响应返回的结果赋值给一个变量，这里应该是一个字典
response_dict = r.json()
print(f"Total repositories:{response_dict['total_count']}")

# 探索有关仓库的信息
repo_dicts = response_dict['items']
print(f"Respositories returned :{len(repo_dicts)}")

repo_dict = repo_dicts[0]
print(f"\n Keys: {len(repo_dict)}")
for key in sorted(repo_dict.keys()):
    print(key)

print(response_dict.keys())

984b165636ecd7b54a1aac592237c3657a675d1c
<mask token>

<mask token>
print(f'status code = {r.status_code}')
<mask token>
print(f"Total repositories:{response_dict['total_count']}")
<mask token>
print(f'Respositories returned :{len(repo_dicts)}')
<mask token>
print(f"""
 Keys: {len(repo_dict)}""")
for key in sorted(repo_dict.keys()):
    print(key)
print(response_dict.keys())

<mask token>
url = (
    'https://api.github.com/search/repositories?&q=language:python&sort=stars')
headers = {'Accept': 'application/vnd.github.v3+json'}
r = requests.get(url, headers=headers)
print(f'status code = {r.status_code}')
response_dict = r.json()
print(f"Total repositories:{response_dict['total_count']}")
repo_dicts = response_dict['items']
print(f'Respositories returned :{len(repo_dicts)}')
repo_dict = repo_dicts[0]
print(f"""
 Keys: {len(repo_dict)}""")
for key in sorted(repo_dict.keys()):
    print(key)
print(response_dict.keys())

import requests
url = (
    'https://api.github.com/search/repositories?&q=language:python&sort=stars')
headers = {'Accept': 'application/vnd.github.v3+json'}
r = requests.get(url, headers=headers)
print(f'status code = {r.status_code}')
response_dict = r.json()
print(f"Total repositories:{response_dict['total_count']}")
repo_dicts = response_dict['items']
print(f'Respositories returned :{len(repo_dicts)}')
repo_dict = repo_dicts[0]
print(f"""
 Keys: {len(repo_dict)}""")
for key in sorted(repo_dict.keys()):
    print(key)
print(response_dict.keys())

import requests

# 执行API调用并存储响应
url = 'https://api.github.com/search/repositories?&q=language:python&sort=stars'
headers = {'Accept': 'application/vnd.github.v3+json'}
r = requests.get(url, headers=headers)
print(f"status code = {r.status_code}")

# 将api响应返回的结果赋值给一个变量，这里应该是一个字典
response_dict = r.json()
print(f"Total repositories:{response_dict['total_count']}")

# 探索有关仓库的信息
repo_dicts = response_dict['items']
print(f"Respositories returned :{len(repo_dicts)}")

repo_dict = repo_dicts[0]
print(f"\n Keys: {len(repo_dict)}")
for key in sorted(repo_dict.keys()):
    print(key)

print(response_dict.keys())
