Pyjo.AWS.Credentials.Process - Credentials of an external program

from Pyjo.AWS.Credentials.Process import Process

credentials = Process(command='aws configure export-credentials --profile dev').credentials()

# Or import the module, as in Google Python Style Guide

import Pyjo.AWS.Credentials.Process

provider = Pyjo.AWS.Credentials.Process.new(command='/opt/bin/credentials --role admin')
provider.credentials_p().then(lambda credentials: print(credentials.expiration)).wait()

Pyjo.AWS.Credentials.Process is the provider of the credentials that an external program prints, as the setting credential_process of a profile runs it: the command is split as a shell splits it, but run without a shell, and prints the credentials as JSON:

{
  "Version": 1,
  "AccessKeyId": "AKIDEXAMPLE",
  "SecretAccessKey": "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
  "SessionToken": "token",
  "Expiration": "2026-11-03T12:00:00Z"
}

A program that exits with an error is an error with what the program prints on its standard error, and one that prints something else is an error too.

See also

Pyjo.AWS.Credentials.Provider, Pyjo.AWS.Credentials.Profile, https://docs.aws.amazon.com/sdkref/latest/guide/feature-process-credentials.html.

Classes

class Pyjo.AWS.Credentials.Process.Pyjo_AWS_Credentials_Process(*, command: str, **kwargs: Any)[source]

Pyjo.AWS.Credentials.Process inherits all attributes and methods from Pyjo.AWS.Credentials.Provider and implements the following new ones.

__init__(*, command: str, **kwargs: Any) → None[source]
provider = Pyjo.AWS.Credentials.Process.new(command='/opt/bin/credentials')

Construct a new Pyjo.AWS.Credentials.Process object, with the options of Pyjo.AWS.Credentials.Provider.

command
command = provider.command
provider.command = '/opt/bin/credentials --role admin'

The command of the program, with its arguments.

async fetch() → Pyjo_AWS_Credentials | None[source]
credentials = await provider.fetch()

The credentials that the program prints.