Version: 1.2.0
ramrod.stix Module¶
-
ramrod.stix.get_version(doc)¶ Returns the version number for input STIX document.
-
ramrod.stix.register_updater(cls)¶ Registers a STIX updater class.
-
ramrod.stix.update(doc, from_=None, to_=None, options=None, force=False)¶ Updates a STIX document to align with a given version of the STIX Language schemas.
Parameters: - doc – A STIX document filename, file-like object,
etree._Element, oretree._ElementTree. - from (optional, string) – The base version for the update process. If
None, an attempt will be made to extract the version number from doc. - to (optional, string) – The version to update to. If
None, the latest version of STIX is assumed. - options (optional) – A
ramrod.UpdateOptionsinstance. IfNone,ramrod.DEFAULT_UPDATE_OPTIONSwill be used. - force (boolean) – Forces the update process. This may result in content being removed during the update process and could result in schema-invalid content. Use at your own risk!
Returns: An instance of
ramrod.UpdateResults.Raises: UpdateError– If any of the following conditions are encountered:- The from_ or to_ versions are invalid.
- An untranslatable field is encountered and force is
False. - A non-unique ID is encountered and force is
False.
InvalidVersionError– If the source document version and the from_ value do not match and force isFalse.UnknownVersionError– If the source document does not contain version information and force isFalse.
- doc – A STIX document filename, file-like object,