def main(): v = AnyURI("http://www.example.com/index1.html") v.condition = "Equals" u = URI() u.value = v u.type_ = URI.TYPE_URL print(Observables(u).to_xml())
def main(): NS = cybox.utils.Namespace("http://example.com/", "example") cybox.utils.set_id_namespace(NS) v = AnyURI("http://www.example.com/index1.html") v.condition = "Equals" u = URI() u.value = v u.type_ = URI.TYPE_URL print Observables(u).to_xml()
def main(): print '<?xml version="1.0" encoding="UTF-8"?>' v = AnyURI("www.sample1.com/index.html") v.condition = "Equals" u = URI() u.value = v u.type_ = URI.TYPE_URL o = Observables(u) print o.to_xml()
def from_dict(uri_dict): uri = URI() if "type" in uri_dict: uri.type_ = uri_dict["type"] if "value" in uri_dict: uri.value = AnyURI.from_dict(uri_dict["value"]) return uri
def test_round_trip(self): uri_str = "http://www.example.com" t = URI.TYPE_URL uri = URI(AnyURI(uri_str), t) uri2 = cybox.test.round_trip(uri) self.assertEqual(uri.to_dict(), uri2.to_dict()) self.assertEqual(uri_str, str(uri2)) self.assertEqual(t, uri2.type_)
def from_dict(uri_dict): if uri_dict is None: return None uri = URI() ObjectProperties.from_dict(uri_dict, uri) uri.type_ = uri_dict.get('type') uri.value = AnyURI.from_dict(uri_dict.get('value')) return uri
def from_obj(uri_obj): if not uri_obj: return None uri = URI() ObjectProperties.from_obj(uri_obj, uri) uri.type_ = uri_obj.get_type() uri.value = AnyURI.from_obj(uri_obj.get_Value()) return uri
def from_obj(uri_obj): uri = URI() uri.type_ = uri_obj.get_type() uri.value = AnyURI.from_obj(uri_obj.get_Value()) return uri