Python requests. 403 Forbidden despite copy headers from browser

Viewed 63

I want to access a site with python requests but I get 403 error despite i copy the header of browser and used it. Here is my code,Is there anybody that can solve this problem?

import requests

Url = 'https://bama.ir/'

session = requests.Session()

headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0',
    'Accept-Language': 'en-US,en;q=0.5',
    'Upgrade-Insecure-Requests': '1',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'none',
    'Sec-Fetch-User': '?1',
    'Connection': 'keep-alive',
}
session.headers = headers

r = session.get(Url, headers=headers)
0 Answers
Related