The API server returns a JSON object containing the output of a script retrieved via the submitted id. Previously, a string containing the console output was being returned, but in the interest of providing greater flexibility, a JSON object containing a list of various sections of the output will now be the return value.
This will also ensure that no HTML/JS needs to be generated by the API, and all formatting will handled by the Ember App based on properties defined in the JSON object.
e.g. : print ('hello world') will be output as
{'status':True,
'Filename':script.title,
'Date':script.pub_date
'Id':script.id,
'result':[{"name":"print","type":"span","value":"hello world"}],
}
The various types implemented in the boilerplate code that this PR provides, includes 'span', and 'span-well'
example.py
print ('testing')
print ('testing some changes..... ')
print_('highlighted print statement')
screenshot of output of example.py (id=4 on my testing server)
JSON returned by the API [localhost:8000/runScriptById , POST: id=4 (example.py)] from which the above was generated
The API server returns a JSON object containing the output of a script retrieved via the submitted id. Previously, a string containing the console output was being returned, but in the interest of providing greater flexibility, a JSON object containing a list of various sections of the output will now be the return value. This will also ensure that no HTML/JS needs to be generated by the API, and all formatting will handled by the Ember App based on properties defined in the JSON object.
The various types implemented in the boilerplate code that this PR provides, includes 'span', and 'span-well'
example.py
screenshot of output of example.py (id=4 on my testing server)
JSON returned by the API [localhost:8000/runScriptById , POST: id=4 (example.py)] from which the above was generated