Python Forum

Full Version: [WinError 10061] No connection could be made because the target machine actively refu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
""requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.python.org', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x039F1418>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))""


I am getting the above error, while running the below mentioned code.please help to fix this.
import requests

r=requests.get('https://www.python.org/')
print(r)
r=requests.get('https://www.python.org/')
in you script, r is a structure. you need to take an element
print(r.text) or print(r.content)
use text for, well... text
content if binary
but only if:
r.status_code == 200