blpapi.Service¶
- class blpapi.Service¶
Defines a service which provides access to API data.
A
Service
object is obtained from aSession
and contains theOperation
s (each of which contains its own schema) and the schema forEvent
s which thisService
may produce. AService
object is also used to createRequest
objects used with aSession
to issue requests.Provider services are created to generate API data and must be registered before use.
The
Service
object is a handle to the underlying data which is owned by theSession
. Once aService
has been succesfully opened in aSession
it remains accessible until theSession
is terminated.- authorizationServiceName()¶
Get the authorization service name.
- Returns
The name of the
Service
which must be used in order to authorize access to restricted operations on thisService
. If no authorization is required to access operations on this service an empty string is returned.- Return type
Authorization services never require authorization to use.
- createAdminEvent()¶
-
Use an
EventFormatter
to addMessage
s to theEvent
and set fields.DEPRECATED Use
Service.createPublishEvent()
.
- createAuthorizationRequest(authorizationOperation=None)¶
Create an empty
Request
object forauthorizationOperation
.- Parameters
authorizationOperation – A valid operation on this service
- Returns
An empty request for the specified
authorizationOperation
.- Return type
- Raises
Exception – If
authorizationOperation
does not identify a valid operation in theService
An application must populate the
Request
before issuing it usingSession.sendAuthorizationRequest()
.
- createPublishEvent()¶
-
Use an
EventFormatter
to addMessage
s to theEvent
and set fields.
- createRequest(operation)¶
Create an empty Request object for the specified
operation
.- Parameters
operation – A valid operation on this service
- Returns
An empty request for the specified
operation
.- Return type
- Raises
Exception – If
operation
does not identify a valid operation in theService
An application must populate the
Request
before issuing it usingSession.sendRequest()
.
- createResponseEvent(correlationId)¶
Create a
RESPONSE
Event
to answer the request.- Parameters
correlationId (CorrelationId) – Correlation id to associate with the created event
- Returns
The created response event.
- Return type
Use an
EventFormatter
to addMessage
s to theEvent
and set fields.
- destroy()¶
Destroy the handle using stored dtor
- getEventDefinition(nameOrIndex)¶
Get the definition of a specified event.
- Parameters
nameOrIndex (Name or str or int) – Name or index of the event
- Returns
Object describing the element identified by the specified
nameOrIndex
.- Return type
- Raises
NotFoundException – If
nameOrIndex
is a string andhasEventDefinition(nameOrIndex) != True
IndexOutOfRangeException – If
nameOrIndex
is an integer andnameOrIndex >= numEventDefinitions()
- getOperation(nameOrIndex)¶
- hasEventDefinition(name)¶
- hasOperation(name)¶
- numEventDefinitions()¶
- toString(level=0, spacesPerLevel=4)¶
Convert this
Service
schema to a string.- Parameters
- Returns
This object formatted as a string
- Return type
If
level
is negative, suppress indentation of the first line. IfspacesPerLevel
is negative, format the entire output on one line, suppressing all but the initial indentation (as governed bylevel
).