PDC Client is command line and Python interface to PDC server.
Read the documentation.
$ curl --negotiate -u : -H "Accept: application/json" \
https://pdc.example.com/rest_api/v1/auth/token/obtain/
{"token":"123..."}
$ curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Token 123..." \
-d '{"email": "user@example.com", "username": "user"}' \
https://pdc.example.com/rest_api/v1/contacts/people/
$ pdc_client -s example -x POST -r contacts/people/ \
-d '{"email": "user@example.com", "username": "user"}'
- Handles authentication automatically.
- Data in JSON format by default.
- PDC server defined in configuration file.
See also pdc_client.
from pdc_client import PDCClient
try:
client = PDCClient('example')
client['contacts/people/']({
'email': 'user@example.com',
'username': 'user',
})
except Exception as e:
print(e.response.json())
- Handles request and response data natively as
dict
. - HTTP request API is basically wrapper for BeanBag.
See also API.
This is much more user friendly user high-level interface. A single invocation can perform multiple requests depending on what subcommand you used.
See also pdc.
Install using yum
of dnf
.
sudo dnf install pdc-client
Or install from PyPI.
pip install pdc-client
See also Installation.
Configuration file ~/.config/pdc/client_config.json
defines connections to
PDC servers with optional tokens and plugins for pdc
utility.
{
"prod": {
"host": "https://pdc.example.com/rest_api/v1/",
"plugins": ["permission.py", "release.py"]
}
}
See also Configuration.
Under enterprise network, Reverse DNS mismatches may cause problems authenticating with Kerberos.
If you can successfully run kinit
but not authenticate yourself to PDC
servers, check /etc/krb5.conf
and make sure that rdns
is set to
false in libdefaults
section. :
[libdefaults]
rdns = false
If you have got the code and setup your development environment, then you could build from source and install the client.
$ git checkout `{release-tag}`
$ tito build --rpm --offline
$ sudo yum install /tmp/tito/noarch/pdc-client*.noarch.rpm
See also Release.
You can add local development server to configuration file
(~/.config/pdc/client_config.json
).
{
"local": {
"host": "http://localhost:8000/rest_api/v1/",
"develop": true,
"ssl-verify": false
}
}