Skip to main content

API client & CLI for https://github.com/realerikrani/project

Project description

projectclient

API client and CLI for https://github.com/realerikrani/project.

CLI

Pip-install projectclient.

Set export PROJECT_CLI_CONFIG_PATH=/path/to/config.ini

which contains the URL of your project API

[DEFAULT]
url = http://localhost:5000

Then can call the

cli_project -h
usage: cli_project [-h] {create,read,delete,key-create,keys-read,key-delete} ...

CLI for managing projects and keys.

positional arguments:
  {create,read,delete,key-create,keys-read,key-delete}
    create              Create a project with a key.
    read                Read a project.
    delete              Delete a project.
    key-create          Create a new key for a project.
    keys-read           Read public keys of a project.
    key-delete          Delete a key.

options:
  -h, --help            show this help message and exit

API Client

from realerikrani.projectclient import JWTAuth, ProjectClient
from realerikrani.baseclient import BaseAdapter, BaseClient


def create_project_client() -> ProjectClient:
    adapter = BaseAdapter()
    with requests.Session() as session:
        jwt_auth = None
        with suppress(KeyError):
            jwt_auth = JWTAuth(YOUR_CONF[YOUR_PROJECT_ID], YOUR_CONF[YOUR_KEY_ID], YOUR_CONF[YOUR_PRIVATE_KEY_PEM_STR])
        baseclient = BaseClient(
            session=session, adapter=adapter, url=YOUR_URL, auth=jwt_auth
        )
        return ProjectClient(baseclient)

Direct Dependencies:

  • requests - licensed under the Apache License 2.0
  • realerikrani-baseclient - licensed under the Apache License 2.0
  • pyjwt[crypto] - licensed under the MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

realerikrani_projectclient-1.0.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

realerikrani_projectclient-1.0.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file realerikrani_projectclient-1.0.0.tar.gz.

File metadata

File hashes

Hashes for realerikrani_projectclient-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f63e6fa70f7ed39064ed90fe125949b9d1c7428f450624c7f6f7917824a0c14c
MD5 9589ed6f9a565e6f736b11046b8d32e6
BLAKE2b-256 cfdc8e3ffcb4907885f918b9593c902ff3698d3f20f4d9fee2cc85bcd0613b2b

See more details on using hashes here.

File details

Details for the file realerikrani_projectclient-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for realerikrani_projectclient-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59639a99c7f42bfea9be8b83d597ec5e80b75191a5dcefb6d1ae37597cff51a3
MD5 a0a524be5b2b69bfcd1b4970b206f325
BLAKE2b-256 a32bf9e8ec029541fd740d582700ebeda97f317bbc21978cebda18da91194109

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page