Convert in Background

The example code of making Nemo Rig in background using tool

import requests
import time
import shutil
import re

url = "https://www.nemopuppet.com/api"

message = {
    'username': '',
    'password': '',
}

recv = requests.post(url+'/login', data=message)
auth = recv.cookies

files = {'file': open('__GRAPH.json','rb')}
message = {'platform': 'Windows', 'gpu': True}
recv = requests.post(url+'/tasks', data=message, files=files, cookies=auth)
task_id = recv.json()['id']

while True:
    recv = requests.get('{}/task/{}'.format(url, task_id), cookies=auth)
    task_status = recv.json()['status']
    print(task_status)
    if task_status in {'Waiting', 'Running'}:
        time.sleep(5)
    else:
        break

if task_status == 'Success':
    recv = requests.get(url+'/artifact/{}'.format(task_id), stream=True, cookies=auth)
    filename = re.findall('filename=\"(.+)\"', recv.headers['content-disposition'])[0]

    with open('<BinaryZipFolder>/{}'.format(filename), 'wb') as f:
        shutil.copyfileobj(recv.raw, f)

Last updated