blpapi.Service¶
-
class
blpapi.Service¶ Defines a service which provides access to API data.
A
Serviceobject is obtained from aSessionand contains theOperations (each of which contains its own schema) and the schema forEvents which thisServicemay produce. AServiceobject is also used to createRequestobjects used with aSessionto issue requests.Provider services are created to generate API data and must be registered before use.
The
Serviceobject is a handle to the underlying data which is owned by theSession. Once aServicehas been succesfully opened in aSessionit remains accessible until theSessionis terminated.Get the authorization service name.
- Returns
The name of the
Servicewhich 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
EventFormatterto addMessages to theEventand set fields.DEPRECATED Use
Service.createPublishEvent().
-
createAuthorizationRequest(authorizationOperation=None)¶ Create an empty
Requestobject forauthorizationOperation.- Parameters
authorizationOperation – A valid operation on this service
- Returns
An empty request for the specified
authorizationOperation.- Return type
- Raises
Exception – If
authorizationOperationdoes not identify a valid operation in theService
An application must populate the
Requestbefore issuing it usingSession.sendAuthorizationRequest().
-
createPublishEvent()¶ -
Use an
EventFormatterto addMessages to theEventand 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
operationdoes not identify a valid operation in theService
An application must populate the
Requestbefore issuing it usingSession.sendRequest().
-
createResponseEvent(correlationId)¶ Create a
RESPONSEEventto answer the request.- Parameters
correlationId (CorrelationId) – Correlation id to associate with the created event
- Returns
The created response event.
- Return type
Use an
EventFormatterto addMessages to theEventand set fields.
-
destroy()¶
-
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
nameOrIndexis a string andhasEventDefinition(nameOrIndex) != TrueIndexOutOfRangeException – If
nameOrIndexis an integer andnameOrIndex >= numEventDefinitions()
-
getOperation(nameOrIndex)¶
-
hasEventDefinition(name)¶
-
hasOperation(name)¶
-
numEventDefinitions()¶
-
toString(level=0, spacesPerLevel=4)¶ Convert this
Serviceschema to a string.- Parameters
- Returns
This object formatted as a string
- Return type
If
levelis negative, suppress indentation of the first line. IfspacesPerLevelis negative, format the entire output on one line, suppressing all but the initial indentation (as governed bylevel).