Например, ответ сервера
Код: Выделить всё
"taskStatus":"4"
Я попробуйте использовать модули «thread» и «schedule», чтобы проверить это. Но это все равно приводит к сбою приложения.
Вы можете увидеть мой пример кода
Код: Выделить всё
from threading import Thread
def post_device_status_background():
api_url_get = "http://*.*.*.*:7000/ics/out/task/getTaskOrderStatus"
data = {
"areaId": "1",
"deviceType": "0",
"deviceCode": "khang0000"
}
try:
response = requests.post(api_url_get, json=data)
print("Device status:", response.json())
except Exception as e:
print(f"Error: {e}")
def post_device_status(self, dt):
Thread(target=post_device_status_background).start()
Clock.schedule_interval(post_device_status, 10)
Подробнее здесь: https://stackoverflow.com/questions/793 ... not-make-t