Installation of the OpenDevelop Python wrapper can be done using pip.
pip install opendevelop
Initiates the OpenDevelop client. It gets 3 optional parameters;
-
host = os.getenv('OPENDEVELOP_HOST')
-
client_id = os.getenv('OPENDEVELOP_CLIENT_ID')
-
client_secret = os.getenv('OPENDEVELOP_CLIENT_SECRET')
from opendevelop import OpenDevelop client = OpenDevelop()
Returns a Python list with the available images for the current OpenDevelop installation
images = client.images()
[u'base']
Creates a sandbox and executes the given commands inside it. It returns the slug of the sandbox is Python string format.
sandbox_slug = client.create_sandbox(image='base', cmd='ls -l ')
u'19cc2425738661a6'
Creates a sandbox, uploads the files, that correspond to the given absolute file paths, to it and executes the given commands inside it. It returns the slug of the sandbox is Python string format.
sandbox_slug = client.create_sandbox(image='base', cmd='python hello.py', files=['/home/user/Desktop/hello.py'])
u'a4eb0e47e8e51724'
Returns information about the sandbox identified by the given slug. Returns the data in Python dict format.
data = client.sandbox(sandbox_log)
{u'cmd': u'["python hello.py"]',
u'image': u'base',
u'logs': u'Hello OpenDevelop!\n',
u'return_code': 0,
u'status': u'terminated'}