Add submit job to HTML page

This commit is contained in:
Brett Williams
2022-12-10 16:16:37 -08:00
parent d0b14fc001
commit 10dd5b4295
6 changed files with 276 additions and 79 deletions

12
lib/server_helper.py Normal file
View File

@@ -0,0 +1,12 @@
import requests
import os
import json
def post_job_to_server(input_path, job_list, client, server_port=8080):
# Pack job data and submit to server
job_files = {'file': (os.path.basename(input_path), open(input_path, 'rb'), 'application/octet-stream'),
'json': (None, json.dumps(job_list), 'application/json')}
req = requests.post(f'http://{client}:{server_port}/api/add_job', files=job_files)
return req