python.python_doc_auth_partial.mustache Maven / Gradle / Ivy
The newest version!
{{#hasAuthMethods}}
{{#authMethods}}
configuration = {{{packageName}}}.Configuration()
{{#isBasic}}
{{#isBasicBasic}}
# Configure HTTP basic authorization: {{{name}}}
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
{{/isBasicBasic}}
{{#isBasicBearer}}
# Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}}
configuration.access_token = 'YOUR_BEARER_TOKEN'
{{/isBasicBearer}}
{{#isHttpSignature}}
# Configure HTTP signature authorization: {{{name}}}
# You can specify the signing key-id, private key path, signing scheme, signing algorithm,
# list of signed headers and signature max validity.
configuration.signing_info = {{{packageName}}}.signing.HttpSigningConfiguration(
key_id = 'my-key-id',
private_key_path = 'rsa.pem',
signing_scheme = signing.SCHEME_HS2019,
signing_algorithm = signing.ALGORITHM_RSASSA_PSS,
signed_headers = [signing.HEADER_REQUEST_TARGET,
signing.HEADER_CREATED,
signing.HEADER_EXPIRES,
signing.HEADER_HOST,
signing.HEADER_DATE,
signing.HEADER_DIGEST,
'Content-Type',
'Content-Length',
'User-Agent'
],
signature_max_validity = datetime.timedelta(minutes=5)
)
{{/isHttpSignature}}
{{/isBasic}}
{{#isApiKey}}
# Configure API key authorization: {{{name}}}
configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'
{{/isApiKey}}
{{#isOAuth}}
# Configure OAuth2 access token for authorization: {{{name}}}
configuration.access_token = 'YOUR_ACCESS_TOKEN'
{{/isOAuth}}
{{/authMethods}}
# Defining host is optional and default to {{{basePath}}}
configuration.host = "{{{basePath}}}"
{{/hasAuthMethods}}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy