Nechceš to aspoň vyextrahovat někam nahoru? 😆
This commit is contained in:
8
main.py
8
main.py
@@ -7,6 +7,10 @@ import json
|
|||||||
import httpx
|
import httpx
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
# Some useful variables
|
||||||
|
PEEHAITCHPEA_ENDPOINT = "http://localhost:9000/api.php?cmd=getselectedmessage"
|
||||||
|
PYTHAGORAS_PORT = 9000
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
@@ -120,7 +124,7 @@ async def fetch_selected_message():
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
response = await client.get("http://localhost:9000/api.php?cmd=getselectedmessage")
|
response = await client.get(PEEHAITCHPEA_ENDPOINT)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
message = response.text.strip()
|
message = response.text.strip()
|
||||||
if message:
|
if message:
|
||||||
@@ -160,4 +164,4 @@ async def startup_event():
|
|||||||
|
|
||||||
# Main function and app entry point
|
# Main function and app entry point
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
|
uvicorn.run("main:app", host="0.0.0.0", port=PYTHAGORAS_PORT, reload=True)
|
||||||
|
Reference in New Issue
Block a user