Catalog PyPI
PACKAGE EXPLORERView in registry

agilicus

PyPI

Agilicus SDK

Versions collected1
Direct dependencies24From release 1.443.3
Last observed21 Oct, 09:08 UTC

README

Version 1.443.3 documentation

Agilicus SDK (Python)

The Agilicus Platform API. is defined using OpenAPI 3.0, and may be used from any language. This allows configuration of our Zero-Trust Network Access cloud native platform using REST. You can see the API specification online.

This package provides a Python SDK, class library interfaces for use in accessing individual collections. In addition it provides a command-line-interface (CLI) for interactive use.

Read the class-library documentation online

Samples shows various examples of this code in use.

Generally you may install this from pypi as:

pip install --upgrade agilicus

You may wish to add bash completion by adding this to your ~/.bashrc:

eval "$(_AGILICUS_CLI_COMPLETE=source agilicus-cli)"

Example: List users

The below python code will show the same output as the CLI command: agilicus-cli --issuer https://auth.dbt.agilicus.cloud list-users

import agilicus
import argparse
import sys

scopes = agilicus.scopes.DEFAULT_SCOPES

parser = argparse.ArgumentParser(description="update-user")
parser.add_argument("--auth-doc", type=str)
parser.add_argument("--issuer", type=str)
parser.add_argument("--email", type=str)
parser.add_argument("--disable-user", type=bool, default=None)
args = parser.parse_args()

if not args.auth_doc and not args.issuer:
    print("error: specify either an --auth-doc or --issuer")
    sys.exit(1)

if not args.email:
    print("error: specify an email to search for a user")
    sys.exit(1)

api = agilicus.GetClient(
    agilicus_scopes=scopes, issuer=args.issuer, authentication_document=args.auth_doc
)

users = api.users.list_users(org_id=api.default_org_id, email=args.email)
if len(users.users) != 1:
    print(f"error: failed to find user with email: {args.email}")
    sys.exit(1)

user = users.users[0]

if args.disable_user is not None:
    user.enabled = args.disable_user

result = api.users.replace_user(
    user.id, user=user, _check_input_type=False, _host_index=0
)
print(result)

Using an existing access token

GetClient obtains a token itself (browser login or an authentication document). If you already hold an access token, for example from a browserless OIDC flow, pass it as token and the credential prompt is skipped:

api = agilicus.GetClient(
    token=access_token, api_url="https://api.agilicus.com"
)

The token is used as-is; api.default_org_id is read from its org claim.

Usage metrics

All services are available on the returned helper. The CLI's get-usage-metrics command is built on the same endpoint:

usage = api.metrics.list_usage_metrics(
    org_id=api.default_org_id,
    dt_from="now-30d",
    bucket_size="P1D",
    breakdown_by=["org_id", "resource_type"],
)
for bucket in usage.data:
    print(bucket.time, bucket.org_id, bucket.resource_type, bucket.access_count)

# Page through every row; `limit` is a total and pages are fetched for you.
rows = api.metrics.list_usage_metrics.auto_paging_iter(
    org_id=api.default_org_id,
    bucket_size="P1D",
    breakdown_by=["org_id", "resource_type"],
    page_size=500,
).all()

The helper exposes both naming conventions: api.metrics (the historical GetClient style) and api.metrics_api (the CLI ApiHelper style), so code can move between the two without changes. The same applies to every service.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.443.321 Oct 202624

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:08 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:d20ec9c5e8e592f61016005ada14d335f012a453907d99f884beba9459fbd764