PyObjC Framework SafetyKit

12.1 · active · verified Tue Apr 14

PyObjC Framework SafetyKit provides Python wrappers for the macOS SafetyKit framework, allowing Python applications to interact with Apple's APIs related to parental controls and screen time. It is part of the larger PyObjC project, which bridges Python and Objective-C. The current version is 12.1, and releases typically align with macOS SDK updates and PyObjC core library releases.

Warnings

Install

Imports

Quickstart

Demonstrates how to import the `SafetyKit` framework and access a representative class like `SNSafetyChecker`. Actual interaction with SafetyKit APIs requires consulting Apple's official documentation for Objective-C, as PyObjC provides direct bindings.

import SafetyKit
import objc

# SafetyKit provides APIs for parental controls and screen time.
# Actual usage typically involves interacting with system services
# and requires specific macOS versions and user permissions.

# This quickstart demonstrates importing the framework and accessing a known class.
try:
    # SNSafetyChecker is a primary class within the SafetyKit framework.
    _ = SafetyKit.SNSafetyChecker
    print("Successfully imported SafetyKit and accessed SNSafetyChecker class.")
    print("Refer to Apple's official SafetyKit documentation for detailed API usage.")

    # Example: To interact with a class, you would follow Apple's Objective-C API patterns.
    # For instance, if SNSafetyChecker had a static method 'isSupported':
    # if hasattr(SafetyKit.SNSafetyChecker, 'isSupported'):
    #     print(f"SNSafetyChecker.isSupported(): {SafetyKit.SNSafetyChecker.isSupported()}")

except AttributeError:
    print("Could not find SNSafetyChecker in SafetyKit. "
          "This might indicate an unsupported macOS version or an incorrect class name.")
except Exception as e:
    print(f"An unexpected error occurred during SafetyKit access: {e}")

view raw JSON →