|
10 | 10 |
|
11 | 11 | Python library to interact with DefectDojo - generated from OpenAPI definition using https://openapi-generator.tech/ |
12 | 12 |
|
13 | | -## Install |
| 13 | +Multiple changes done on top of default openapi-generator: |
| 14 | +* A friendlier Client class |
| 15 | +* Tweak validations to reduce package import time to about 1/3 |
| 16 | +* Remove most of pydantic/schema validations due to inconsistencies with actual database schema/requirements (tracked in https://github.com/fopina/defectdojo-api-generated/issues/39) |
| 17 | +* A nice CLI exposing all the API methods <3 |
| 18 | + * installed only as an extra, to keep everything clean when package is used as library only |
| 19 | + |
| 20 | +## Example |
| 21 | + |
| 22 | +### Library |
14 | 23 |
|
15 | 24 | ``` |
16 | 25 | pip install defectojo-api-generated |
17 | 26 | ``` |
18 | 27 |
|
19 | | -## Usage |
20 | | - |
21 | 28 | ```python |
22 | 29 | from defectdojo_api_generated import DefectDojo |
23 | 30 |
|
24 | 31 | # password publicly available in https://github.com/DefectDojo/django-DefectDojo/?tab=readme-ov-file#demo |
25 | | -# then get API token from https://demo.defectdojo.org/api/key-v2 |
26 | | -dojo = DefectDojo('https://demo.defectdojo.org/', token=...) |
| 32 | +dojo = DefectDojo('https://demo.defectdojo.org/', username='admin', password='...') |
27 | 33 | r = dojo.findings_api.list() |
28 | 34 | print(r.json()) |
29 | 35 | ``` |
30 | 36 |
|
31 | | -## Build |
| 37 | +#### **Full documentation** [in docs](docs/README.md) |
| 38 | + |
| 39 | +### CLI |
| 40 | + |
| 41 | +[](https://asciinema.org/a/fIPDy8iYxGL85pXb) |
| 42 | + |
| 43 | +> [uv](https://docs.astral.sh/uv/) recommended or [pipx](https://github.com/pypa/pipx) |
| 44 | +
|
| 45 | +``` |
| 46 | +uv tool install 'defectojo-api-generated[cli]' |
| 47 | +``` |
| 48 | + |
| 49 | +``` |
| 50 | +$ dojo |
| 51 | +Usage: dojo [OPTIONS] COMMAND [ARGS]... |
| 52 | +
|
| 53 | + DefectDojo CLI |
| 54 | +
|
| 55 | +Options: |
| 56 | + ... |
| 57 | +Commands: |
| 58 | + api Interact directly with any API/method |
| 59 | + config Show or edit the current CLI configuration |
| 60 | + status Quick connectivity check |
| 61 | +``` |
| 62 | + |
| 63 | +You can also skip tool install and just run it with: |
| 64 | + |
| 65 | +``` |
| 66 | +$ uvx 'defectojo-api-generated[cli]' |
| 67 | +Usage: dojo [OPTIONS] COMMAND [ARGS]... |
| 68 | +... |
| 69 | +``` |
| 70 | + |
| 71 | +## Contributing |
32 | 72 |
|
33 | 73 | Check out [CONTRIBUTING.md](CONTRIBUTING.md) |
34 | 74 |
|
|
0 commit comments