Skip to content

PSAT API Python v4.0.0

Latest

Choose a tag to compare

@ljerabek ljerabek released this 02 Jul 16:39
0ea965e

v4.0.0 is the first Klarient-based release of psat-api. This is a major release because the package has been rebuilt around a typed resource model while continuing to target the public PSAT v0.3.0 reporting API.

The previous public release line was v3.1.0, which removed older PSAT v0.1.0/v0.2.0 endpoint support and targeted the v0.3.0 API. This release continues that direction with a cleaner typed client implementation. See the
previous release context in the GitHub releases page: https://github.com/pfptcommunity/psat-api-python/releases

Highlights

  • Rebuilt the client on top of Klarient.

  • Models the PSAT v0.3.0 reporting API as a typed resource tree.

  • Provides typed report resources for:

    • CyberStrength
    • Enrollments
    • PhishAlarm
    • Phishing
    • Phishing Extended
    • Training
    • Users
  • Provides typed report rows and nested attributes objects for response data.

  • Provides typed filter objects for each report type.

  • Supports paging through Klarient Page objects with direct access to page metadata such as page_size, current_page_number, last_page_number, record_count, and navigation links.

  • Supports automatic page iteration through pageable resources.

  • Supports custom user tags through enable_user_tags() and with_user_tag().

  • Supports network configuration through RequestsOptions, including timeout, proxy, and SSL verification settings.

  • Includes endpoint-focused examples for each report area.

Breaking Changes

v4.0.0 is a major release and is not guaranteed to be backward compatible with the 3.x client API. The package has been rebuilt on Klarient, which changes the public object model, pagination model, response wrappers, filtering
objects, and network configuration surface.

Known compatibility changes include:

  • Requires Python 3.11 or newer.
  • Requires klarient[requests]>=0.3.0.
  • The client is now modeled as a typed resource tree.
  • Report responses are Klarient Page objects.
  • Pagination metadata is exposed through properties such as record_count, page_size, current_page_number, last_page_number, self_link, and next_link.
  • Network settings now use RequestsOptions and RequestsTimeout.
  • Filters and response objects have been remodeled around typed request and response classes.

Recommended migration approach: review the updated README and examples before upgrading production code from 3.x to 4.x.

Install

pip install psat-api

Basic Usage

from psat import Region
from psat.v0_3_0 import PSATClient

client = PSATClient(Region.US, "")

page = client.reports.phishing.retrieve()

print(page.record_count)

for row in page:
print(row.attributes.user_email_address)
print(row.attributes.campaign_name)

Full Changelog: v3.1.0...v4.0.0