Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goneri/python-dci
https://github.com/goneri/python-dci
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/goneri/python-dci
- Owner: goneri
- Created: 2018-09-07T17:00:44.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-17T23:11:11.000Z (almost 6 years ago)
- Last Synced: 2024-10-03T17:23:04.750Z (about 2 months ago)
- Language: Python
- Size: 75.2 KB
- Stars: 0
- Watchers: 3
- 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.clientjob_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.oojob_id = '28cd1fe9-f5a8-4f65-8f76-d6b7aa89e08d'
c = dci.oo.Engine()
j = c.jobs.get('1')
```### Change the admin password
```python
import dci.ooc = dci.oo.Engine(dci_login="admin")
admin = c.users.first(where="name:admin")
print(admin.name)
admin.password = 'admin'
admin.commit()
```