Open kkuehl opened 9 years ago
Hey, @kkuehl, sorry for the (woefully) late response.
It looks like you might be mixing "bindings" objects and "API" objects. Most bindings objects have class names ending in Type
, and you manipulate them by calling get_X
or set_X
. API classes do not end in Type
, and you manipulate them by directly getting or setting attributes. It looks like "observables" is a binding object (cybox.bindings.cybox_core.ObservablesType
), while source
is an API object cybox.common.MeasureSource
.
You can get around this by changing:
observables.set_Observable_Package_Source(source)
to
observables.set_Observable_Package_Source(source.to_obj())
but you might be better off using the API version: cybox.core.Observables
. API objects were designed to be easier to use than the bindings objects, which are defined in auto-generated code. to_obj
converts an API object to a binding object, and you can do the reverse with Observables.from_obj(<binding_obj>)
For a larger discussion of API objects vs. Binding objects (in the context of STIX, but the concept is identical), see http://stix.readthedocs.org/en/latest/api_vs_bindings/index.html
I am attempting to add Observable_Package_Source.
File "/usr/lib/python2.7/site-packages/cybox-2.0.1.2-py2.7.egg/cybox/bindings/cybox_core.py", line 912, in exportChildren self.Observable_PackageSource.export(outfile, level, "cybox:", name='Observable_Package_Source', pretty_print=pretty_print) AttributeError: 'MeasureSource' object has no attribute 'export'
Am I adding the Observable_Package_Source incorrectly?
...