Skip to content

client.library

Manage live response library files.

Property

client.library

Methods

  • get_all() -> LibraryFilesResults: list live response library files.
  • upload(payload: LibraryFilesUpdatePayload) -> bool: upload a library file.
  • delete(file_name: str) -> bool: delete a library file.

Notes

  • upload() and delete() return booleans rather than results wrappers.
  • LibraryFilesUpdatePayload includes file metadata such as file_name, file_content, content_type, and descriptions.

API

Live-response library files endpoint for the Defender for Endpoint API.

Exposes LibraryFilesEndpoint for listing, uploading, and deleting scripts stored in the live-response library at /api/libraryfiles. Upload payloads are modelled by LibraryFilesUpdatePayload, which produces the multipart form-data body required by the API.

LibraryFilesUpdatePayload

Multipart form-data payload for uploading live response library files.

to_request_kwargs

to_request_kwargs() -> dict[str, Any]

Serialize the payload into httpx multipart request kwargs.

LibraryFilesResults

LibraryFilesResults(
    endpoint: BaseEndpoint,
    params: dict[str, str],
    *,
    path: str | None = None,
    single: bool = False,
    files: bool = False,
    method: str = "GET",
    request_kwargs: dict[str, Any] | None = None,
    use_concurrent_skip_pagination: bool | None = None,
    skip_page_size: int | None = None,
    skip_max_concurrent: int | None = None,
)

Results from the /api/libraryFiles endpoint.

LibraryFilesEndpoint

LibraryFilesEndpoint(http: Client, auth: MSALAuth)

Endpoint for /api/libraryFiles.

get_all

get_all() -> LibraryFilesResults

Get all library files.

Docs: - https://learn.microsoft.com/en-us/defender-endpoint/api/list-library-files

upload

upload(payload: LibraryFilesUpdatePayload) -> bool

Update a library file.

If successful, this method returns 200 - OK response code and the uploaded live response library entity in the response body. If not successful: this method returns 400 - Bad Request. Bad request usually indicates incorrect body.

Docs: - https://learn.microsoft.com/en-us/defender-endpoint/api/upload-library

delete

delete(file_name: str) -> bool

Delete a library file.

If successful, this method returns 204 - No Content response code. If not successful: this method returns 404 - Not Found. Not Found usually indicates that the file with the specified name does not exist.

Docs: - https://learn.microsoft.com/en-us/defender-endpoint/api/delete-library-file