SiemplifySession module

SiemplifySession is a class for managing Siemplify sessions.

Examples
  • Create a SiemplifySession object:

    >>> session = SiemplifySession(["password", "user_name"])
    
  • Encode sensitive data in an error message:

    >>> message = "An error occurred while connecting to the Siemplify API: {}.".format(session.encode_sensitive_data("password"))
    
  • Encode a string:

    >>> encoded_string = session.encode_data("password")
    

class TIPCommon.SiemplifySession.SiemplifySession

class TIPCommon.SiemplifySession.SiemplifySession(sensitive_data_arr=[])

Bases: Session

A class for managing Siemplify sessions that inherits from Session and provides a way to encode sensitive data in error messages.

The following attributes are available:

  • sensitive_data_arr – A list of sensitive data strings.

The following methods are available:

  • request() – Makes a request to the Siemplify API.
  • encode_sensitive_data() – Encodes sensitive data in an error message.
  • encode_data() – Encodes a string.

static encode_data

static encode_data(sensitive_data)

Encodes a string.

Parameters
sensitive_data str

The string to encode.

Returns

The encoded string.

encode_sensitive_data

encode_sensitive_data(message)

Encodes sensitive data in an error message.

Parameters
message str

The error message containing sensitive data.

Returns

The error message with encoded sensitive data.

request

request(method, url, **kwargs)

Makes a request to the Siemplify API.

Parameters
method str

HTTP method.

url str

Requested URL.

**kwargs Additional keyword arguments to pass to the request.

Returns

The response from the request.