blpapi.Service
- class blpapi.Service(handle, sessions)
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.
- Return type:
- 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.
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 (
Optional
[str
]) – A valid operation on this service- Return type:
- Returns:
An empty request for the specified
authorizationOperation
.- 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 (
str
) – A valid operation on this service- Return type:
- Returns:
An empty request for the specified
operation
.- 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 – Correlation id to associate with the created event
- Returns:
The created response event.
Use an
EventFormatter
to addMessage
s to theEvent
and set fields.
- eventDefinitions()
- Return type:
- Returns:
An iterator over unsolicited events defined by this
Service
.
- getEventDefinition(nameOrIndex)
Get the definition of a specified event.
- Parameters:
- Returns:
Object describing the element identified by the specified
nameOrIndex
.- Raises:
NotFoundException – If
nameOrIndex
is a string andhasEventDefinition(nameOrIndex) != True
IndexOutOfRangeException – If
nameOrIndex
is an integer andnameOrIndex >= numEventDefinitions()
- Return type:
- getOperation(nameOrIndex)
- hasEventDefinition(name)
- numEventDefinitions()
- operations()
- toString(level=0, spacesPerLevel=4)
Convert this
Service
schema to a string.- Parameters:
- Return type:
- Returns:
This object formatted as a string
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
).