blpapi.Request

class blpapi.Request(handle, sessions)

A single request to a single service.

Request objects are created using Service.createRequest() or Service.createAuthorizationRequest(). They are used with Session.sendRequest() or Session.sendAuthorizationRequest().

The Request object contains the parameters for a single request to a single service. Once a Request has been created its fields can be populated directly using the functions provided by Element or using the Element interface on the Element returned by asElement().

The schema for the Request can be queried using the Element interface.

__getitem__(name)

Equivalent to asElement().__getitem__(name).

Note

Please use Name over str where possible for name. Name objects should be initialized once and then reused in order to minimize lookup cost.

__setitem__(name, value)

Equivalent to asElement().__setitem__(name, value).

Note

Please use Name over str where possible for name. Name objects should be initialized once and then reused in order to minimize lookup cost.

append(name, value)

Equivalent to getElement(name).appendValue(value).

Note

Please use Name over str where possible for name. Name objects should be initialized once and then reused in order to minimize lookup cost.

asElement()
Returns

The content of this Request as an Element.

Return type

Element

destroy()

Destroy the handle using stored dtor

Return type

None

fromPy(requestDict)

Equivalent to asElement().fromPy(requestDict).

Parameters

requestDict (collections.abc.Mapping) – used to format this Request. See Element.fromPy() for more details.

Note

Using fromPy() to format a Request that has already been formatted is not supported. To further format a Request, use set() / append() or the *Element() methods.

Return type

None

getElement(name)

Equivalent to asElement().getElement(name).

Note

Please use Name over str where possible for name. Name objects should be initialized once and then reused in order to minimize lookup cost.

getRequestId()

Return the request’s id if one exists, otherwise return None.

If there are issues with this request, the request id can be reported to Bloomberg for troubleshooting purposes.

Note that request id is not the same as correlation id and should not be used for correlation purposes.

Return type

str

Returns

The request id of the request.

set(name, value)

Equivalent to asElement().setElement(name, value).

Note

Please use Name over str where possible for name. Name objects should be initialized once and then reused in order to minimize lookup cost.

toString(level=0, spacesPerLevel=4)

Equivalent to asElement().toString(level, spacesPerLevel).

Return type

str