Ejemplo n.º 1
0
    def create_inbox_message(self, entity):
        '''Create an inbox message.

        Methods emits :py:const:`opentaxii.signals.INBOX_MESSAGE_CREATED` signal.

        :param `opentaxii.taxii.entities.InboxMessageEntity` entity:
            inbox message entity in question
        :return: updated inbox message entity
        :rtype: :py:class:`opentaxii.taxii.entities.InboxMessageEntity`
        '''

        if self.server.config['save_raw_inbox_messages']:
            entity = self.api.create_inbox_message(entity)
            INBOX_MESSAGE_CREATED.send(self, inbox_message=entity)

        return entity
Ejemplo n.º 2
0
    def create_inbox_message(self, entity):
        '''Create an inbox message.

        Methods emits :py:const:`opentaxii.signals.INBOX_MESSAGE_CREATED` signal.

        :param `opentaxii.taxii.entities.InboxMessageEntity` entity:
            inbox message entity in question
        :return: updated inbox message entity
        :rtype: :py:class:`opentaxii.taxii.entities.InboxMessageEntity`
        '''

        if self.server.config['save_raw_inbox_messages']:
            entity = self.api.create_inbox_message(entity)
            INBOX_MESSAGE_CREATED.send(self, inbox_message=entity)

        return entity
Ejemplo n.º 3
0
from opentaxii.signals import (
    CONTENT_BLOCK_CREATED, INBOX_MESSAGE_CREATED, SUBSCRIPTION_CREATED
)


def post_create_content_block(manager, content_block, collection_ids,
        service_id):
    print 'Content block id=%s (collections=%s, service_id=%s) was created' % (
            content_block.id, ', '.join(map(str, collection_ids)), service_id)


def post_create_inbox_message(manager, inbox_message):
    print 'Inbox message id=%s was created' % inbox_message.id


def post_create_subscription(manager, subscription):
    print 'Subscription id=%s (service_id=%s) was created' % (subscription.id,
            subscription.service_id)


CONTENT_BLOCK_CREATED.connect(post_create_content_block)
INBOX_MESSAGE_CREATED.connect(post_create_inbox_message)
SUBSCRIPTION_CREATED.connect(post_create_subscription)