P
P
Python Newbie2021-11-12 11:10:15
Python
Python Newbie, 2021-11-12 11:10:15

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)


But, not what I see on the site is written to the file.
Didn't fit in here. Here on github: https://github.com/lev007-ops/habr_errors/blob/mai...

Update: launched via live server and saw this: 3PtIcwPL.jpg?download=1&name=%D0%A1%D0%BA%D1%80%D0%B8%D0%BD%D1%88%D0%BE%D1%82%2012-11-2021%2011:14 :34.jpg

Not what I want

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question