API overview¶
Everything is importable from the top-level package. The full type surface is declared in type stubs, so IDEs and type checkers resolve all of it.
What's in the box¶
| Group | Members | Reference |
|---|---|---|
| Exceptions | StixError, ValidationError, DeserializationError |
Exceptions |
| Functions | version(), validate_pattern() |
Functions |
| Domain objects | 19 SDO classes (AttackPattern, Identity, Malware, …) |
Domain objects |
| Relationship objects | Relationship, Sighting |
Domain objects |
| Meta objects | MarkingDefinition, ExtensionDefinition, LanguageContent |
Domain objects |
| Cyber-observables | 18 SCO classes (File, IPv4Address, NetworkTraffic, …) |
Cyber-observables |
| Vocabularies | 8 enum classes (.values(), .is_valid()) |
Vocabularies |
| Bundles & custom | Bundle, CustomObject |
Domain objects |
Shared behavior¶
All SDO and SCO classes share the same interface:
Class(**properties)— construct; required properties enforcedClass.from_json(json_str, strict=True, allow_custom=False)— parse and validateobj.to_json()— serialize back to STIX 2.1 JSONobj.type,obj.id,obj.spec_version— common propertiesobj.custom_properties— properties outside the specification- Typed accessors for standard properties; unknown attributes raise
AttributeError
See validation modes for strict and
allow_custom semantics, and error handling for the
structured error entries.