mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Add submit job to HTML page
This commit is contained in:
12
lib/server_helper.py
Normal file
12
lib/server_helper.py
Normal 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
|
||||
Reference in New Issue
Block a user