-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsocketpy.py
More file actions
37 lines (27 loc) · 815 Bytes
/
socketpy.py
File metadata and controls
37 lines (27 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import base64
import subprocess
import test
import uuid
import socketio
import win32print
sio = socketio.Client()
@sio.on('connect')
def on_connect():
# Write code for connected on('add user') with uuid and alias
# for on_reconnect
print("connected!")
with open('credentials.txt', 'r') as file:
cred = file.readlines()
print(cred)
@sio.on('pdfData')
def on_message(data):
try:
print(data.keys(), type(data['pdf']))
data_rec = bytearray(base64.b64decode(data['pdf']))
filename = str(uuid.uuid4())
with open("{0}.ps".format(filename), "wb") as file:
file.write(data_rec)
test.generatePrint(filename)
# Write code to take print out below
except BaseException as e:
print("in except", str(e))