Код: Выделить всё
import aiohttp
import asyncio
import requests
url = 'https://www.olx.ua/uk/list/q-%D0%BA%D0%BE%D0%BF%D0%BE%D1%87%D0%BA%D0%B8-43/?search%5Bfilter_float_price:to%5D=1500'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36',
'Accept-Encoding': 'gzip, deflate',
'Accept': '*/*',
'Connection': 'keep-alive',
}
resp = requests.get(url=url, headers=headers)
print(resp.status_code)
#Output 200
async def main():
async with aiohttp.ClientSession() as session:
async with session.get(url, headers=headers) as response:
print(response.status)
asyncio.run(main())
#Output 403
Подробнее здесь: https://stackoverflow.com/questions/793 ... 0-response