Spaces:
Running
Running
Update test.py
Browse files
test.py
CHANGED
@@ -270,16 +270,12 @@ async def test_websocket(websocket: WebSocket):
|
|
270 |
# less_process.communicate(input=json_str.encode("utf-8"))
|
271 |
if data:
|
272 |
data_new[filename]=str(data[:10])
|
273 |
-
# data_new.append({filename:data.encode("UTF-8")})
|
274 |
-
# Decode base64-encodattaed attachment data
|
275 |
-
# print(filename)s
|
276 |
attachment_content = base64.urlsafe_b64decode(data.encode("UTF-8"))
|
277 |
-
|
278 |
-
|
279 |
-
# print(data_new)
|
280 |
attachment_no+=1
|
281 |
time.sleep(2)
|
282 |
-
await websocket.send_json({filename:data})
|
283 |
|
284 |
# yield f"data: {str(data_new)}\n\n"
|
285 |
|
|
|
270 |
# less_process.communicate(input=json_str.encode("utf-8"))
|
271 |
if data:
|
272 |
data_new[filename]=str(data[:10])
|
|
|
|
|
|
|
273 |
attachment_content = base64.urlsafe_b64decode(data.encode("UTF-8"))
|
274 |
+
await websocket.send_json({"filename": filename})
|
275 |
+
await websocket.send_bytes(attachment_content)
|
|
|
276 |
attachment_no+=1
|
277 |
time.sleep(2)
|
278 |
+
# await websocket.send_json({filename:data})
|
279 |
|
280 |
# yield f"data: {str(data_new)}\n\n"
|
281 |
|