if the request succeededthe downloaded web page is stored as string in the response object' text variable this variable holds large string of the entire playthe call to len(res textshows you that it is more than , characters long finallycalling print(res text[: ]displays only the first characters if the request failed and displayed an error messagelike "failed to establish new connectionor "max retries exceeded,then check your internet connection connecting to servers can be quite complicatedand can' give full list of possible problems here you can find common causes of your error by doing web search of the error message in quotes checking for errors as you've seenthe response object has status_code attribute that can be checked against requests codes ok ( variable that has the integer value to see whether the download succeeded simpler way to check for success is to call the raise_for_status(method on the response object this will raise an exception if there was an error downloading the file and will do nothing if the download succeeded enter the following into the interactive shellres requests get(res raise_for_status(traceback (most recent call last)file ""line in file " :\users\al\appdata\local\programs\python\python \lib\site-packages\requests\models py"line in raise_for_status raise httperror(http_error_msgresponse=selfrequests exceptions httperror client errornot found for urlcom/page_that_does_not_exist html the raise_for_status(method is good way to ensure that program halts if bad download occurs this is good thingyou want your program to stop as soon as some unexpected error happens if failed download isn' deal breaker for your programyou can wrap the raise_for_status(line with try and except statements to handle this error case without crashing import requests res requests get('tryres raise_for_status(except exception as excprint('there was problem% (exc)this raise_for_status(method call causes the program to output the followingthere was problem client errornot found for urlinventwithpython com/page_that_does_not_exist html