C
C
CleanyBoom2021-08-07 22:03:07
Python
CleanyBoom, 2021-08-07 22:03:07

Website returns 404 when sending requests?

import requests

url = f'https://subtitry.ru/'
response = requests.get(url)
print(response)

The code above is with the site. It works on its own, and when sending a request it returns 404, can this be fixed somehow, or not?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex F, 2021-08-08
​​@CleanyBoom

import requests

headers = {
    'User-Agent': ('Mozilla/5.0 (Windows NT 6.0; rv:14.0) Gecko/20100101 '
                   'Firefox/14.0.1'),
    'Accept':
    'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Accept-Language':
    'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3',
    'Accept-Encoding':
    'gzip, deflate',
    'Connection':
    'keep-alive',
    'DNT':
    '1'
}

url = f'https://subtitry.ru/'
response = requests.post(url, headers=headers).text
print(response)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question