コード例 #1
0
ファイル: utils.py プロジェクト: yangzhihobg/OpenTAXII
def persist_content(manager,
                    collection_name,
                    service_id,
                    timestamp=None,
                    binding=CB_STIX_XML_111,
                    subtypes=[]):

    timestamp = timestamp or get_utc_now()

    content_binding = entities.ContentBindingEntity(binding=binding,
                                                    subtypes=subtypes)

    content = entities.ContentBlockEntity(content=CONTENT,
                                          timestamp_label=timestamp,
                                          message=MESSAGE,
                                          content_binding=content_binding)

    collection = manager.get_collection(collection_name, service_id)

    if not collection:
        raise ValueError('No collection with name {}'.format(collection_name))

    content = manager.create_content(content, collections=[collection])

    return content
コード例 #2
0
ファイル: utils.py プロジェクト: EclecticIQ/OpenTAXII
def persist_content(manager, collection_name, service_id, timestamp=None,
                    binding=CB_STIX_XML_111, subtypes=[]):

    timestamp = timestamp or get_utc_now()

    content_binding = entities.ContentBindingEntity(
        binding=binding,
        subtypes=subtypes
    )

    content = entities.ContentBlockEntity(
        content=CONTENT, timestamp_label=timestamp,
        message=MESSAGE, content_binding=content_binding)

    collection = manager.get_collection(collection_name, service_id)

    if not collection:
        raise ValueError('No collection with name {}'.format(collection_name))

    content = manager.create_content(content, collections=[collection])

    return content