mixbox
raw JSON → 1.0.5 verified Fri May 01 auth: no python maintenance
Utility library providing shared functions and classes for the CybOX, MAEC, and STIX Python packages. Current version 1.0.5, in maintenance mode with no active development since 2018.
pip install mixbox Common errors
error AttributeError: module 'mixbox' has no attribute 'idgen' ↓
cause Trying to import idgen directly from mixbox instead of the subpackage.
fix
Use: from mixbox import idgen
error TypeError: create_id() argument 1 must be mixbox.namespaces.Namespace, not str ↓
cause Passing a string prefix to idgen.create_id() instead of a namespace object.
fix
ns = namespaces.get_namespace('your_prefix')
id_ = idgen.create_id(ns)
Warnings
deprecated mixbox is in maintenance mode. New projects should use stix2, maec5, or cybox2 directly. ↓
fix Migrate to the newer STIX/MAEC/CybOX libraries (e.g., stix2 for STIX 2.x).
gotcha mixbox.namespaces is not a dict: do not iterate over it with .items() or .values(). Use namespace lookup functions instead. ↓
fix Use namespaces.get_namespace(name) instead of treating the module as a dictionary.
gotcha idgen.create_id() requires a namespace object (not a string). Passing a string will break. ↓
fix First obtain a namespace via namespaces.get_namespace('prefix') and then pass it to idgen.create_id().
deprecated The vizard submodule (vizard) is deprecated and may be removed in future releases. ↓
fix Avoid using vizard; use direct lxml manipulation or a dedicated validation library.
Imports
- Mixbox
from mixbox import idgen, namespaces, dates, errors, vizard
Quickstart
from mixbox import idgen, namespaces, dates, errors
# Generate a unique ID with a specified namespace
namespace = namespaces.get_namespace('myns')
id_ = idgen.create_id(namespace)
print(id_)
# Parse an ISO 8601 date string
dt = dates.parse_date('2015-01-01T12:00:00Z')
print(dt)