问题遇到的现象和发生背景
在练习《python编程 从入门到实践》一书的第17章时,我在调用GitHub的api时总是提示443错误,无论是挂代理还是使用devside car都不能解决问题
问题相关代码,请勿粘贴截图
import requests
url = 'https://api.githun.com/search/reppositories?q=language:python&sort=stars'
r = requests.get(url)
print('Status Code:', r.status_code)
response_dict = r.json()
print(response_dict.keys())
运行结果及报错内容
发生异常: ConnectionError
HTTPSConnectionPool(host='api.githun.com', port=443): Max retries exceeded with url: /search/reppositories?q=language:python&sort=stars (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001F03E0C52B0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。'))
During handling of the above exception, another exception occurred:
During handling of the above exception, another exception occurred:
During handling of the above exception, another exception occurred:
File "E:\BaiduNetdiskWorkspace\Python代码集合\书籍\Chapter_17\python_repos.py", line 5, in <module>
r = requests.get(url)