QRS API Authentication

class qrs_api_client.auth.AuthManager(cert_path=None, key_path=None, root_cert_path=None, user_id=None, password=None)[source]

Bases: object

Manages authentication for connecting to services, supporting certificate and NTLM authentication.

get_auth(session: Session, auth_method='certificate', verify_ssl=True)[source]

Configures and returns the authentication for the specified method.

Parameters:
  • session (requests.Session) – The session object to configure.

  • auth_method (str, optional) – The authentication method to use (‘certificate’ or ‘ntlm’).

  • verify_ssl (bool or str, optional) – Either a boolean for SSL verification or the path to a root.pem file.

Returns:

The configured session object.

Return type:

requests.Session

Raises:

ValueError – If an unknown authentication method is specified.

get_certificate_auth()[source]

Returns the certificate and key paths as a tuple for certificate-based authentication.

Returns:

A tuple containing the certificate path and key path.

Return type:

tuple

Raises:

ValueError – If cert_path or key_path is not provided.

get_ntlm_auth()[source]

Creates an NTLM authentication object.

Returns:

An instance of HttpNtlmAuth for NTLM authentication.

Return type:

HttpNtlmAuth

Raises:

ValueError – If user_id or password is not provided.