jina.types.request package#
Submodules#
- jina.types.request.data module
DataRequest
DataRequest.is_decompressed
DataRequest.is_decompressed_with_data
DataRequest.is_decompressed_wo_data
DataRequest.proto_wo_data
DataRequest.proto
DataRequest.proto_with_data
DataRequest.to_dict()
DataRequest.docs
DataRequest.data
DataRequest.CopyFrom()
DataRequest.MergeFrom()
DataRequest.add_exception()
DataRequest.binary_str()
DataRequest.clear()
DataRequest.dict()
DataRequest.json()
DataRequest.nbytes
DataRequest.parameters
DataRequest.pop()
DataRequest.to_bytes()
DataRequest.to_json()
DataRequest.response
DataRequest.status
DataRequest.request_id
DataRequest.from_proto()
Response
Response.CopyFrom()
Response.MergeFrom()
Response.add_exception()
Response.binary_str()
Response.clear()
Response.dict()
Response.docs
Response.from_proto()
Response.is_decompressed
Response.is_decompressed_with_data
Response.is_decompressed_wo_data
Response.json()
Response.nbytes
Response.parameters
Response.pop()
Response.proto
Response.proto_with_data
Response.proto_wo_data
Response.request_id
Response.response
Response.status
Response.to_bytes()
Response.to_dict()
Response.to_json()
- jina.types.request.status module
StatusMessage
StatusMessage.CopyFrom()
StatusMessage.MergeFrom()
StatusMessage.binary_str()
StatusMessage.clear()
StatusMessage.dict()
StatusMessage.json()
StatusMessage.nbytes
StatusMessage.pop()
StatusMessage.proto
StatusMessage.set_exception()
StatusMessage.to_bytes()
StatusMessage.to_dict()
StatusMessage.to_json()
StatusMessage.set_code()
Module contents#
- class jina.types.request.Request[source]#
Bases:
ProtoTypeMixin
Request
is one of the primitive data types in Jina, and serves as a base forDataRequest
andResponse
.It offers a Pythonic interface to allow users access and manipulate
jina.jina_pb2.RequestProto
object without working with Protobuf itself.It serves as a container for serialized
jina_pb2.RequestProto
that only triggers deserialization and decompression when receives the first read access to its member.It overrides
__getattr__()
to provide the same get/set interface as anjina_pb2.RequestProto
object.- add_exception(ex=None, executor=None)[source]#
Add exception to the last route in the envelope :type ex:
Optional
[Exception
] :param ex: Exception to be added :type executor:Optional
[BaseExecutor
] :param executor: Executor related to the exception- Return type:
None
- CopyFrom(other)#
Copy the content of target
- Parameters:
other (
TypeVar
(T
)) – the document to copy from- Return type:
None
- MergeFrom(other)#
Merge the content of target
- Parameters:
other (
TypeVar
(T
)) – the document to merge from- Return type:
None
- binary_str(**kwargs)#
- clear()#
Remove all values from all fields of this Document.
- Return type:
None
- dict(**kwargs)#
- json(**kwargs)#
- property nbytes: int#
Return total bytes consumed by protobuf.
- Return type:
int
- Returns:
number of bytes
- pop(*fields)#
Remove the values from the given fields of this Document.
- Parameters:
fields – field names
- Return type:
None
- property proto#
Return the underlying Protobuf object
- Returns:
Protobuf representation of the object
- to_bytes()#
Return the serialized the message to a string.
For more Pythonic code, please use
bytes(...)
.- Return type:
bytes
- Returns:
binary string representation of the object
- to_dict(**kwargs)#
Return the object in Python dictionary.
Note
Array like object such as
numpy.ndarray
(i.e. anything described asjina_pb2.NdArrayProto
) will be converted to Python list.- Parameters:
kwargs – Extra kwargs to be passed to MessageToDict, like use_integers_for_enums
- Return type:
Dict
- Returns:
dict representation of the object
- to_json()#
Return the object in JSON string
- Return type:
str
- Returns:
JSON string of the object