pyFirecrest is a python wrapper for FirecREST
Project description
PyFirecREST
This is a simple python wrapper for the FirecREST API.
How to install
-
Through PyPI:
python3 -m pip install pyfirecrest
How to use
The full documentation of pyFirecREST is in this page but you can get an idea from the following example.
This is how you can use the testbuild from the demo environment here.
The configuration corresponds to the account firecrest-sample
.
import firecrest as f7t
# Configuration parameters for the Authorization Object
client_id = "firecrest-sample"
client_secret = "b391e177-fa50-4987-beaf-e6d33ca93571"
token_uri = "http://localhost:8080/auth/realms/kcrealm/protocol/openid-connect/token"
# Create an authorization account object with Client Credentials authorization grant
keycloak = f7t.ClientCredentialsAuthorization(
client_id, client_secret, token_uri, debug=False
)
class MyKeycloakCCAccount:
def __init__(self):
pass
@keycloak.account_login
def get_access_token(self):
return keycloak.get_access_token()
# Setup the client for the specific account
client = f7t.Firecrest(
firecrest_url="http://localhost:8000", authorization=MyKeycloakCCAccount()
)
try:
parameters = client.parameters()
print(f"Firecrest parameters: {parameters}")
except f7t.FirecrestException as e:
# When the error comes from the responses to a firecrest request you will get a
# `FirecrestException` and from this you can examine the http responses yourself
# through the `responses` property
print(e)
print(e.responses)
except Exception as e:
# You might also get regular exceptions in some cases. For example when you are
# trying to upload a file that doesn't exist in your local filesystem.
pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyfirecrest-0.0.10.tar.gz
(12.3 kB
view hashes)
Built Distribution
Close
Hashes for pyfirecrest-0.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3875462009afff5e0fe3c88777b896a7effc4c78a9679a89061af3c73690675b |
|
MD5 | 8a081e58b1363c0dde5e19b982f958d1 |
|
BLAKE2b-256 | 983320d6bcd065a106eb758b6e6393d66bd43d0cadefdf2bbaa06b29d5c3f20f |