Код: Выделить всё
from requests_html import AsyncHTMLSession
import asyncio
async def connect_to_site(url):
session = AsyncHTMLSession()
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"}
res = await session.get(url, headers=headers)
print(res)
await res.html.arender(sleep=5, timeout=30)
print(res.html.full_text)
url = 'https://www.otcmarkets.com'
asyncio.run(connect_to_site(url))
Доступ запрещен
Доступ запрещен
У вас нет разрешения на доступ к «http://www.otcmarkets.com/» на этом сервере.
Ссылка #18.9c4519d4.1643149046.338b64e3
Подробнее здесь: https://stackoverflow.com/questions/708 ... this-serve
Мобильная версия