def create_request_message(self, args): poll_fulf_req = tm11.PollFulfillmentRequest( message_id=tm11.generate_message_id(), collection_name=args.collection, result_id=args.result_id, result_part_number=args.result_part_number) return poll_fulf_req
def prepare_fulfilment_request(collection_name, result_id, part_number): return tm11.PollFulfillmentRequest( message_id=MESSAGE_ID, collection_name=collection_name, result_id=result_id, result_part_number=part_number )
def fulfilment(self, collection_name, result_id, part_number=1, uri=None): '''Poll content from Polling Service as a part of fulfilment process. if ``uri`` is not provided, client will try to discover services and find Polling Service among them. :param str collection_name: collection to poll :param str result_id: existing polling Result ID :param int part_number: index number of a part from the result set :param str uri: URI path to a specific Inbox Service :raises ValueError: if URI provided is invalid or schema is not supported :raises `cabby.exceptions.HTTPError`: if HTTP error happened :raises `cabby.exceptions.UnsuccessfulStatusError`: if Status Message received and status_type is not `SUCCESS` :raises `cabby.exceptions.ServiceNotFoundError`: if no service found :raises `cabby.exceptions.AmbiguousServicesError`: more than one service with type specified :raises `cabby.exceptions.NoURIProvidedError`: no URI provided and client can't discover services ''' request = tm11.PollFulfillmentRequest(message_id=self._generate_id(), collection_name=collection_name, result_id=result_id, result_part_number=part_number) stream = self._execute_request(request, uri=uri, service_type=const.SVC_POLL) for obj in stream: if isinstance(obj, tm11.PollResponse): # Verify if more ContentBlocks are available if not obj.more: yield elif isinstance(obj, tm11.ContentBlock): yield to_content_block_entity(obj)