diff --git a/__pycache__/config.cpython-311.pyc b/__pycache__/config.cpython-311.pyc new file mode 100644 index 0000000..0fbacbc Binary files /dev/null and b/__pycache__/config.cpython-311.pyc differ diff --git a/app.py b/app.py index 79b3f7a..4938e84 100644 --- a/app.py +++ b/app.py @@ -8,6 +8,8 @@ import subprocess import urllib3 import threading import urllib.parse +from datetime import datetime, timedelta # Import datetime and timedelta + urllib3.disable_warnings() # Configure logging @@ -131,7 +133,7 @@ def post_info_thread(info): led1 = OutputDevice(23) led2 = OutputDevice(24) name = "idmasa" -logging.info(f"Variabila Id Masa A fost initializata", name) +logging.info("Variabila Id Masa A fost initializata ") f = open("./data/idmasa.txt", "r") # deschid fisierul name = f.readline().strip() # citesc toate liniile f.close() # inchid fisierul @@ -158,6 +160,7 @@ class Reader(rdm6300.BaseReader): post_info_thread(info) led1.on() logging.info(f"card inserted {card}") + logging.info(f"card removed {card}") def card_removed(self, card): if card.value == 12886709: @@ -174,9 +177,9 @@ class Reader(rdm6300.BaseReader): else: logging.info(info) post_info_thread(info) - led1.of() + led1.off() logging.info(f"card removed {card}") - + logging.info(f"card removed {card}") diff --git a/data/log.txt b/data/log.txt index e69de29..4c123c5 100644 --- a/data/log.txt +++ b/data/log.txt @@ -0,0 +1,29 @@ +2025-02-28 11:19:01,515 - INFO - Log file is not older than 10 days: log.txt +2025-02-28 11:19:01,535 - INFO - Internet connection check loaded +2025-02-28 11:19:01,537 - INFO - Log file is not older than 10 days: log.txt +2025-02-28 11:19:01,574 - INFO - Internet is up! Waiting 45 minutes. +2025-02-28 11:19:01,575 - INFO - Reading backup data from tag.txt... +2025-02-28 11:19:01,580 - INFO - Posting backup data: https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/1/2025-02-28&11:13:59 +2025-02-28 11:19:01,580 - INFO - Variabila Id Masa A fost initializata +2025-02-28 11:19:01,586 - INFO - notconfig +2025-02-28 11:19:02,443 - INFO - Request sent, awaiting response... +2025-02-28 11:19:02,445 - ERROR - An error occurred: 404 Client Error: Not Found for url: https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/1/2025-02-28&11:13:59 +2025-02-28 11:19:02,448 - INFO - Backup data updated. +2025-02-28 11:19:11,167 - INFO - https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/1/2025-02-28&11:19:11 + +2025-02-28 11:19:11,171 - INFO - Starting to post data... +2025-02-28 11:19:11,176 - INFO - card inserted CardData(value=4028355, checksum=219, type=82, is_valid=True) +2025-02-28 11:19:11,176 - INFO - card removed CardData(value=4028355, checksum=219, type=82, is_valid=True) +2025-02-28 11:19:11,887 - INFO - Request sent, awaiting response... +2025-02-28 11:19:11,891 - ERROR - An error occurred: 404 Client Error: Not Found for url: https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/1/2025-02-28&11:19:11 +2025-02-28 11:19:11,892 - INFO - Value https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/1/2025-02-28&11:19:11 + was saved to tag.txt +2025-02-28 11:19:14,529 - INFO - https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/0/2025-02-28&11:19:14 + +2025-02-28 11:19:14,531 - INFO - Starting to post data... +2025-02-28 11:19:14,533 - INFO - card removed CardData(value=4028355, checksum=219, type=82, is_valid=True) +2025-02-28 11:19:14,536 - INFO - card removed CardData(value=4028355, checksum=219, type=82, is_valid=True) +2025-02-28 11:19:15,169 - INFO - Request sent, awaiting response... +2025-02-28 11:19:15,170 - ERROR - An error occurred: 404 Client Error: Not Found for url: https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/0/2025-02-28&11:19:14 +2025-02-28 11:19:15,171 - INFO - Value https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/0/2025-02-28&11:19:14 + was saved to tag.txt diff --git a/data/tag.txt b/data/tag.txt index e69de29..637b3c3 100644 --- a/data/tag.txt +++ b/data/tag.txt @@ -0,0 +1,6 @@ +https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/1/2025-02-28&11:13:59 +https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/0/2025-02-28&11:14:07 +https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/1/2025-02-28&11:17:29 +https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/0/2025-02-28&11:17:34 +https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/1/2025-02-28&11:19:11 +https://dataswsibiusb01.sibiusb.harting.intra/RO_Quality_PRD/api/record/notconfig/4028355/0/2025-02-28&11:19:14