https://github.com/goneri/python-dci
https://github.com/goneri/python-dci
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/goneri/python-dci
- Owner: goneri
- Created: 2018-09-07T17:00:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-17T23:11:11.000Z (almost 7 years ago)
- Last Synced: 2025-03-24T03:12:39.998Z (7 months ago)
- Language: Python
- Size: 75.2 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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()
```