我有这个 URL,我成功地调用了这个响应。
https://www.udemy.com/api-2.0/courses/?page=1&page_size=5
现在,我正在尝试模拟响应并测试我的 api,但模拟会抛出一个ConnectionError
with responses.RequestsMock() as rsps:
url = 'https://www.udemy.com/api-2.0/courses/?page=1&page_size=5'
rsps.add(responses.GET, url,
body=mocked_json, status=status_code,
content_type='application/json')
错误:-
ConnectionError: Connection refused: GET https://www.udemy.com/api-2.0/courses?page=1&page_size=5