response gas test

This commit is contained in:
amd64fox 2025-03-21 14:04:35 +03:00 committed by GitHub
parent f5867e41f9
commit 58d07c5029
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

18
upd.py
View file

@ -22,11 +22,19 @@ async def send_request(json_data):
async with session.get(url) as response:
if response.status == 200:
data = await response.text()
soup = BeautifulSoup(data, "html.parser")
system_response = soup.find(
"div",
style="text-align:center;font-family:monospace;margin:50px auto 0;max-width:600px",
).text
if "<div" in data:
soup = BeautifulSoup(data, "html.parser")
div_element = soup.find(
"div",
style="text-align:center;font-family:monospace;margin:50px auto 0;max-width:600px",
)
if div_element:
system_response = div_element.text
else:
system_response = "Не удалось извлечь ответ из HTML"
else:
system_response = data.strip()
print(f"Ответ от GAS: {system_response}")