import requests r = requests.get('http://google.ru') print(type(r)) print(type(r.text)) print(r.text, file = open('a.html', 'w', encoding=r.encoding))