Answer the question
In order to leave comments, you need to log in
Why can't I get html page on python requests?
I have the following code (removed imports):
URL = 'https://meduza.io/'
HEADERS = {
'Accept': '*/*',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'
}
req = requests.get(URL, headers=HEADERS)
src = req.text
# print(src)
with open('site.html', 'w', encoding='UTF-8') as file:
file.write(src)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question