Skip to content

Commit

Permalink
Update python-socketio version in requirements files
Browse files Browse the repository at this point in the history
  • Loading branch information
alevilar committed Sep 16, 2024
1 parent 3be0f79 commit 03ec2f5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion requirements.cli.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python-escpos[all]==3.1
python-socketio[client]
python-socketio[client]==5.11.4
requests==2.32.3
aiohttp==3.10.2
argparse==1.4.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.kivy.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python-escpos[all]==3.1
python-socketio[client]
python-socketio[client]==5.11.4
websocket-client==1.8.0
simple-websocket==1.0.0
requests==2.32.3
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pillow==10.4.0
pypng==0.20220715.0
python-barcode==0.15.1
python-escpos[all]==3.1
python-socketio[client]
python-socketio[client]==5.11.4
PyYAML==6.0.2
qrcode==7.4.2
requests==2.32.3
Expand Down
9 changes: 5 additions & 4 deletions src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@


def start():
logger.info("Iniciando Fiscalberry Server")

serverUrl = configberry.config.get("SERVIDOR", "sio_host", fallback="")
uuid = configberry.config.get("SERVIDOR", "uuid")
send_discover_in_thread()

while True:
logger.info("Preparando Fiscalberry Server")

serverUrl = configberry.config.get("SERVIDOR", "sio_host", fallback="")
uuid = configberry.config.get("SERVIDOR", "uuid")
send_discover_in_thread()
sio = FiscalberrySio(serverUrl, uuid)
sio.start_print_server()
logger.warning("Termino ejecucion de server socketio?.. reconectando en 5s")
Expand Down
4 changes: 0 additions & 4 deletions src/common/EscPComandos.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,6 @@ def printFacturaElectronica(self, escpos: EscposIO, **kwargs):
importeUnitario = floatToString( importe )
totalProducto = f"{round( qty * importe , 2 ):,.2f}"

# si la cantidad qty o el importe importe son 0, no se imprime
if qty == 0 or importe == 0:
continue

if tipoComprobante in tiposInscriptoString or tipoCmp in tiposInscriptoCod:
printer.set(font='b', bold=True, align='left', normal_textsize=True)
printer.text(f"{itemCant} x {importeUnitario} ({floatToString(alicIva)})\n")
Expand Down
20 changes: 10 additions & 10 deletions src/common/fiscalberry_sio.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@ class FiscalberrySio():
stop_event = threading.Event()

def __init__(self, sockeiIoServer, uuid, namespaces = ["/paxaprinter"]) -> None:
self.sio = socketio.Client(reconnection=True, reconnection_attempts=0, reconnection_delay=2, reconnection_delay_max=15, logger=sioLogger, engineio_logger=sioLogger)
self.sio = socketio.Client(reconnection=True, reconnection_attempts=0, reconnection_delay=2, reconnection_delay_max=15, logger=sioLogger, engineio_logger=False)

self.sockeiIoServer = sockeiIoServer
self.uuid = uuid
self.namespaces = namespaces

@self.sio.on("connect", namespace='/paxaprinter')
def handleConnect(**kwargs):
def handleJoin(*args, **kwargs):
print(f"Joined!!!!!!!! OKK {args} {kwargs}")

@self.sio.event(namespace='/paxaprinter')
def connect():
logger.info(f"connection established with sid {self.sio.sid}")
self.sio.emit("join", data=uuid, namespace='/paxaprinter', callback=handleJoin)


@self.sio.event(namespace='/paxaprinter')
def connect_error(err):
logger.error(f"Connection failed due to: {err}")

@self.sio.on('disconnect', namespace='*')
def handleDisconnect():
@self.sio.event(namespace='/paxaprinter')
def disconnect():
logger.info("Disconnected from server")
sys.exit(0)


def start_only_status(self):
self.__run()

Expand All @@ -67,7 +67,7 @@ def start_only_status_in_thread(self) -> threading.Thread:
def __run(self):
try:
logger.info("FiscalberrySio: ******************************* CONECTANDO *******************************")
self.sio.connect(self.sockeiIoServer, namespaces=self.namespaces, headers={"X_UUID":self.uuid})
self.sio.connect(self.sockeiIoServer, namespaces=self.namespaces, headers={"x-uuid":self.uuid})
logger.info("Iniciado SioClient en %s con uuid %s" % (self.sockeiIoServer, self.uuid))
self.sio.wait()

Expand Down

0 comments on commit 03ec2f5

Please sign in to comment.