1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import requests print ( type (res)) print (res.status_code = = requests.codes.ok) print ( len (res.text)) print (res.text[: 250 ]) res.raise_for_status() try : res.raise_for_status() except Exception as exc: print ( f 'There was a problem {exc}' ) |
.text
is used. Why does it have to be used? Why the content of Response type res can't be printed? And if an extension must be added why not .txt
?