wxc_sdk.har_writer package

class wxc_sdk.har_writer.HarWriter(path: None | str | TextIOBase = None, api: WebexSimpleApi | AsWebexSimpleApi = None, with_authorization: bool = False, incremental: bool = False)[source]

Bases: object

log WebexSimpleApi and AsWebexSimpleApi requests and responses to HAR files

__init__(path: None | str | TextIOBase = None, api: WebexSimpleApi | AsWebexSimpleApi = None, with_authorization: bool = False, incremental: bool = False)[source]

Create a new HAR writer

Parameters:
  • path – path to HAR file or stream to write HAR data to. Can be None to disable writing to a file. The recorded HAR data can be retrieved from the har attribute.

  • api – API object to record requests and responses from. If additional API instances (for example a sync and an async API) need to be recorded then additional API instances can be registered using the register_webex_api() and register_as_webex_api() method.

  • with_authorization – flag to indicate if the writer should include authorization headers

  • incremental – write each request to HAR file incrementally instead of only when closing the HarWriter

active: bool

flag to indicate if the writer is active

with_authorization: bool

flag to indicate if the writer should include authorization headers

har: HAR | None

HAR log

unregister_api(reg_id: str) None[source]

unregister an API using an id returned by register_webex_api(), or register_as_webex_api()

Parameters:

reg_id – registration id

register_webex_api(api: WebexSimpleApi) str[source]

Register response callback for WebexSimpleApi

returns a registration id that can be used to unregister an API via unregister_api()

Parameters:

api

register_as_webex_api(api: AsWebexSimpleApi) str[source]

Register response callback for WebexSimpleApi

Parameters:

api

new_entry(entry: HAREntry) None[source]

Log new entry either by adding to entries of HAR object or by writing to IOStream directly

close() None[source]

Subpackages