Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/goneri/python-dci


https://github.com/goneri/python-dci

Last synced: 25 days ago
JSON representation

Awesome Lists containing this project

README

        

# python-dci

`python-dci` is a transport layer with a nice API to interact with Distributed-CI.

## Direct access to the REST API

You can this library to directly the DCI API. In this example, we want to retrieve
all the details from a given job:

```python
import dci.client

job_id = '28cd1fe9-f5a8-4f65-8f76-d6b7aa89e08d'

c = dci.client.DCIClient()

uri_tpl = (
'/jobs/%s'
'?embed=topic,remoteci,components,rconfiguration')

job_info = c.get(uri_tpl % job_id).json()
print(job_info)
```

## The Object interface

This library also provide an object layer on top of the class DCI API.

### Get a job record

```python
import dci.oo

job_id = '28cd1fe9-f5a8-4f65-8f76-d6b7aa89e08d'

c = dci.oo.Engine()
j = c.jobs.get('1')
```

### Change the admin password

```python
import dci.oo

c = dci.oo.Engine(dci_login="admin")
admin = c.users.first(where="name:admin")
print(admin.name)
admin.password = 'admin'
admin.commit()
```