Skip to main content

Python wrapper for OpenDevelop

Project description

******************************
OpenDevelop Python wrapper
******************************

Usage
#####

Initiate client
========

Initiates the OpenDevelop client. It gets 3 optional parameters;

* :code:`host = os.getenv('OPENDEVELOP_HOST')`
* :code:`client_id = os.getenv('OPENDEVELOP_CLIENT_ID')`
* :code:`client_secret = os.getenv('OPENDEVELOP_CLIENT_SECRET')`

from opendevelop import OpenDevelop
client = OpenDevelop()

Get available images
=============

Returns a Python list with the available images for the current OpenDevelop installation

.. code-block:: python

images = client.images()

Example response
----------------

.. code-block:: json

[u'base']

Create a sandbox
===========

Creates a sandbox and executes the given commands inside it. It returns the slug of the sandbox is Python string format.

.. code-block:: python

sandbox_slug = client.create_sandbox(image='base', cmd='ls -l ')

Example response
----------------

.. code-block:: json

u'19cc2425738661a6'

Create a sandbox with some files inside
=========================

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.

.. code-block:: python

sandbox_slug = client.create_sandbox(image='base', cmd='python hello.py', files=['/home/user/Desktop/hello.py'])

Example response
----------------

.. code-block:: json

u'a4eb0e47e8e51724'

Get status and logs of a sandbox
====================

Returns information about the sandbox identified by the given slug. Returns the data in Python dict format.

.. code-block:: python

data = client.sandbox(sandbox_log)

Example response
----------------

.. code-block:: json

{u'cmd': u'["python hello.py"]',
u'image': u'base',
u'logs': u'Hello OpenDevelop!\n',
u'return_code': 0,
u'status': u'terminated'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

OpenDevelop-0.1.tar.gz (3.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page