summaryrefslogtreecommitdiffstats
path: root/onap-dcae-cbs-docker-client/README.md
blob: 5c5c986e5192df6da6e1bc542d32386549307885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Python CBS Docker Client

Used for DCAE Dockerized microservices written in Python. Pulls your configuration from the Config Binding Service

# Client Usage

The environment that this client runs in, whether it be in Docker or "natievely", needs to have the following env variables:
1. `HOSTNAME` is the name of your component in Consul
2. `CONFIG_BINDING_SERVICE` a resolvable hostname to the CBS

## Usage in your code

    >>> from onap_dcae_cbs_docker_client import client
    >>> client.get_config()
    >>> client.get_all()


If the CBS is reachable, but your configuration key is not there, you will get a CantGetConfig exception:

    onap_dcae_cbs_docker_client.exceptions.CantGetConfig

You can access the original HTTP status code and text via the `code` and `text` attributes.

If the CBS is unreachable, you will get an exception:

    onap_dcae_cbs_docker_client.exceptions.CBSUnreachable


# Installation

## Via pip
```
pip install onap-dcae-cbs-docker-client
```

# Testing
```
tox
```

# Version Changes
When changes are made, the versions to be bumped are in:

1. setup.py
2. Changelog.md
3. pom.xml