INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Unsubscribe to the passed pair s ticker channel. | def unsubscribe_from_ticker(self, pair, **kwargs):
"""Unsubscribe to the passed pair's ticker channel.
:param pair: str, Symbol pair to request data for
:param kwargs:
:return:
"""
identifier = ('ticker', pair)
self._unsubscribe('ticker', identifier, symbol=pair,... |
Subscribe to the passed pair s order book channel. | def subscribe_to_order_book(self, pair, **kwargs):
"""Subscribe to the passed pair's order book channel.
:param pair: str, Symbol pair to request data for
:param kwargs:
:return:
"""
identifier = ('book', pair)
self._subscribe('book', identifier, symbol=pair, **k... |
Unsubscribe to the passed pair s order book channel. | def unsubscribe_from_order_book(self, pair, **kwargs):
"""Unsubscribe to the passed pair's order book channel.
:param pair: str, Symbol pair to request data for
:param kwargs:
:return:
"""
identifier = ('book', pair)
self._unsubscribe('book', identifier, symbol=p... |
Subscribe to the passed pair s raw order book channel. | def subscribe_to_raw_order_book(self, pair, prec=None, **kwargs):
"""Subscribe to the passed pair's raw order book channel.
:param pair: str, Symbol pair to request data for
:param prec:
:param kwargs:
:return:
"""
identifier = ('raw_book', pair)
prec = '... |
Unsubscribe to the passed pair s raw order book channel. | def unsubscribe_from_raw_order_book(self, pair, prec=None, **kwargs):
"""Unsubscribe to the passed pair's raw order book channel.
:param pair: str, Symbol pair to request data for
:param prec:
:param kwargs:
:return:
"""
identifier = ('raw_book', pair)
pr... |
Subscribe to the passed pair s trades channel. | def subscribe_to_trades(self, pair, **kwargs):
"""Subscribe to the passed pair's trades channel.
:param pair: str, Symbol pair to request data for
:param kwargs:
:return:
"""
identifier = ('trades', pair)
self._subscribe('trades', identifier, symbol=pair, **kwarg... |
Unsubscribe to the passed pair s trades channel. | def unsubscribe_from_trades(self, pair, **kwargs):
"""Unsubscribe to the passed pair's trades channel.
:param pair: str, Symbol pair to request data for
:param kwargs:
:return:
"""
identifier = ('trades', pair)
self._unsubscribe('trades', identifier, symbol=pair,... |
Subscribe to the passed pair s OHLC data channel. | def subscribe_to_candles(self, pair, timeframe=None, **kwargs):
"""Subscribe to the passed pair's OHLC data channel.
:param pair: str, Symbol pair to request data for
:param timeframe: str, {1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h,
1D, 7D, 14D, 1M}
:param kwarg... |
Unsubscribe to the passed pair s OHLC data channel. | def unsubscribe_from_candles(self, pair, timeframe=None, **kwargs):
"""Unsubscribe to the passed pair's OHLC data channel.
:param timeframe: str, {1m, 5m, 15m, 30m, 1h, 3h, 6h, 12h,
1D, 7D, 14D, 1M}
:param kwargs:
:return:
"""
valid_tfs =... |
Authenticate with the Bitfinex API. | def authenticate(self):
"""Authenticate with the Bitfinex API.
:return:
"""
if not self.key and not self.secret:
raise ValueError("Must supply both key and secret key for API!")
self.channel_configs['auth'] = {'api_key': self.key, 'secret': self.secret}
self.... |
Cancel one or multiple orders via Websocket. | def cancel_order(self, multi=False, **order_identifiers):
"""Cancel one or multiple orders via Websocket.
:param multi: bool, whether order_settings contains settings for one, or
multiples orders
:param order_identifiers: Identifiers for the order(s) you with to cancel
... |
Parse environment variables into a Python dictionary suitable for passing to the device client constructor as the options parameter | def parseEnvVars():
"""
Parse environment variables into a Python dictionary suitable for passing to the
device client constructor as the `options` parameter
- `WIOTP_IDENTITY_APPID`
- `WIOTP_AUTH_KEY`
- `WIOTP_AUTH_TOKEN`
- `WIOTP_OPTIONS_DOMAIN` (optional)
- `WIOTP_OPTIONS_LOGLEVEL` ... |
Parse a yaml configuration file into a Python dictionary suitable for passing to the device client constructor as the options parameter # Example Configuration File identity: appId: myApp auth: key: a - 23gh56 - sdsdajhjnee token: Ab$76s ) asj8_s5 options: domain: internetofthings. ibmcloud. com logLevel: error|warning... | def parseConfigFile(configFilePath):
"""
Parse a yaml configuration file into a Python dictionary suitable for passing to the
device client constructor as the `options` parameter
# Example Configuration File
identity:
appId: myApp
auth:
key: a-23gh56-sdsdajhjnee
toke... |
Internal callback for device command messages parses source device from topic string and passes the information on to the registered device command callback | def _onCommand(self, client, userdata, pahoMessage):
"""
Internal callback for device command messages, parses source device from topic string and
passes the information on to the registered device command callback
"""
try:
command = Command(pahoMessage, self._message... |
Internal callback for gateway command messages parses source device from topic string and passes the information on to the registered device command callback | def _onDeviceCommand(self, client, userdata, pahoMessage):
"""
Internal callback for gateway command messages, parses source device from topic string and
passes the information on to the registered device command callback
"""
try:
command = Command(pahoMessage, self._... |
Internal callback for gateway notification messages parses source device from topic string and passes the information on to the registered device command callback | def _onMessageNotification(self, client, userdata, pahoMessage):
"""
Internal callback for gateway notification messages, parses source device from topic string and
passes the information on to the registered device command callback
"""
try:
note = Notification(pahoMe... |
Gets the list of Historian connectors they are used to configure the Watson IoT Platform to store IoT data in compatible services. Parameters: - nameFilter ( string ) - Filter the results by the specified name - typeFilter ( string ) - Filter the results by the specified type Available values: cloudant eventstreams - e... | def find(self, nameFilter=None, typeFilter=None, enabledFilter=None, serviceId=None):
"""
Gets the list of Historian connectors, they are used to configure the Watson IoT Platform to store IoT data in compatible services.
Parameters:
- nameFilter(string) - Filt... |
Create a connector for the organization in the Watson IoT Platform. The connector must reference the target service that the Watson IoT Platform will store the IoT data in. Parameters: - name ( string ) - Name of the service - serviceId ( string ) - must be either eventstreams or cloudant - timezone ( string ) - - desc... | def create(self, name, serviceId, timezone, description, enabled):
"""
Create a connector for the organization in the Watson IoT Platform.
The connector must reference the target service that the Watson IoT Platform will store the IoT data in.
Parameters:
- name (string) - N... |
Updates the connector with the specified uuid. if description is empty the existing description will be removed. Parameters: - connector ( String ) Connnector Id which is a UUID - name ( string ) - Name of the service - timezone ( json object ) - Should have a valid structure for the service type. - description ( strin... | def update(self, connectorId, name, description, timezone, enabled):
"""
Updates the connector with the specified uuid.
if description is empty, the existing description will be removed.
Parameters:
- connector (String), Connnector Id which is a UUID
- name (strin... |
Gets the list of services that the Watson IoT Platform can connect to. The list can include a mixture of services that are either bound or unbound. Parameters: - nameFilter ( string ) - Filter the results by the specified name - typeFilter ( string ) - Filter the results by the specified type Available values: cloudant... | def find(self, nameFilter=None, typeFilter=None, bindingModeFilter=None, boundFilter=None):
"""
Gets the list of services that the Watson IoT Platform can connect to.
The list can include a mixture of services that are either bound or unbound.
Parameters:
-... |
Create a new external service. The service must include all of the details required to connect and authenticate to the external service in the credentials property. Parameters: - serviceName ( string ) - Name of the service - serviceType ( string ) - must be either eventstreams or cloudant - credentials ( json object )... | def create(self, serviceBinding):
"""
Create a new external service.
The service must include all of the details required to connect
and authenticate to the external service in the credentials property.
Parameters:
- serviceName (string) - Name of the service
... |
Updates the service with the specified id. if description is empty the existing description will be removed. Parameters: - serviceId ( String ) Service Id which is a UUID - serviceName ( string ) name of service - credentials ( json ) json object of credentials - description - description of the service Throws APIExcep... | def update(self, serviceId, serviceName, credentials, description):
"""
Updates the service with the specified id.
if description is empty, the existing description will be removed.
Parameters:
- serviceId (String), Service Id which is a UUID
- serviceName (string... |
Register one or more new device types each request can contain a maximum of 512KB. | def create(self, deviceType):
"""
Register one or more new device types, each request can contain a maximum of 512KB.
"""
r = self._apiClient.post("api/v0002/device/types", deviceType)
if r.status_code == 201:
return DeviceType(apiClient=self._apiClient, **r.json())... |
Publish an event to Watson IoT Platform. | def publishEvent(self, event, msgFormat, data, qos=0, on_publish=None):
"""
Publish an event to Watson IoT Platform.
# Parameters
event (string): Name of this event
msgFormat (string): Format of the data for this event
data (dict): Data for this event
qos (int): ... |
Retrieve the organization - specific status of each of the services offered by the IBM Watson IoT Platform. In case of failure it throws APIException | def serviceStatus(self):
"""
Retrieve the organization-specific status of each of the services offered by the IBM Watson IoT Platform.
In case of failure it throws APIException
"""
r = self._apiClient.get("api/v0002/service-status")
if r.status_code == 200:
... |
Register one or more new devices each request can contain a maximum of 512KB. The response body will contain the generated authentication tokens for all devices. You must make sure to record these tokens when processing the response. We are not able to retrieve lost authentication tokens It accepts accepts a list of de... | def create(self, devices):
"""
Register one or more new devices, each request can contain a maximum of 512KB.
The response body will contain the generated authentication tokens for all devices.
You must make sure to record these tokens when processing the response.
We are not abl... |
Update an existing device | def update(self, deviceUid, metadata=None, deviceInfo=None, status=None):
"""
Update an existing device
"""
if not isinstance(deviceUid, DeviceUid) and isinstance(deviceUid, dict):
deviceUid = DeviceUid(**deviceUid)
deviceUrl = "api/v0002/device/types/%s/devices/%s"... |
Delete one or more devices each request can contain a maximum of 512Kb It accepts accepts a list of devices ( List of Dictionary of Devices ) In case of failure it throws APIException | def delete(self, devices):
"""
Delete one or more devices, each request can contain a maximum of 512Kb
It accepts accepts a list of devices (List of Dictionary of Devices)
In case of failure it throws APIException
"""
if not isinstance(devices, list):
listOfDe... |
Iterate through all Connectors | def find(self, status=None, connectedAfter=None):
"""
Iterate through all Connectors
"""
queryParms = {}
if status:
queryParms["status"] = status
if connectedAfter:
queryParms["connectedAfter"] = connectedAfter
return IterableClientStatusL... |
List all device management extension packages | def list(self):
"""
List all device management extension packages
"""
url = "api/v0002/mgmt/custom/bundle"
r = self._apiClient.get(url)
if r.status_code == 200:
return r.json()
else:
raise ApiException(r) |
Create a new device management extension package In case of failure it throws APIException | def create(self, dmeData):
"""
Create a new device management extension package
In case of failure it throws APIException
"""
url = "api/v0002/mgmt/custom/bundle"
r = self._apiClient.post(url, dmeData)
if r.status_code == 201:
return r.json()
... |
Delete a device management extension package It accepts bundleId ( string ) as parameters In case of failure it throws APIException | def delete(self, bundleId):
"""
Delete a device management extension package
It accepts bundleId (string) as parameters
In case of failure it throws APIException
"""
url = "api/v0002/mgmt/custom/bundle/%s" % (bundleId)
r = self._apiClient.delete(url)
if r... |
Update a device management extension package It accepts bundleId ( string ) as parameters In case of failure it throws APIException | def update(self, bundleId, dmeData):
"""
Update a device management extension package
It accepts bundleId (string) as parameters
In case of failure it throws APIException
"""
url = "api/v0002/mgmt/custom/bundle/%s" % (bundleId)
r = self._apiClient.put(url, dmeData... |
Registers a new thing. It accepts thingTypeId ( string ) thingId ( string ) name ( string ) description ( string ) aggregatedObjects ( JSON ) and metadata ( JSON ) as parameters In case of failure it throws APIException | def registerThing(self, thingTypeId, thingId, name = None, description = None, aggregatedObjects = None, metadata=None):
"""
Registers a new thing.
It accepts thingTypeId (string), thingId (string), name (string), description (string), aggregatedObjects (JSON) and metadata (JSON) as parameters
... |
Gets thing details. It accepts thingTypeId ( string ) thingId ( string ) In case of failure it throws APIException | def getThing(self, thingTypeId, thingId):
"""
Gets thing details.
It accepts thingTypeId (string), thingId (string)
In case of failure it throws APIException
"""
thingUrl = ApiClient.thingUrl % (self.host, thingTypeId, thingId)
r = requests.get(thingUrl, auth=sel... |
Gets details for multiple things of a type It accepts thingTypeId ( string ) and parameters In case of failure it throws APIException | def getThingsForType(self, thingTypeId, parameters = None):
"""
Gets details for multiple things of a type
It accepts thingTypeId (string) and parameters
In case of failure it throws APIException
"""
thingsUrl = ApiClient.thingsUrl % (self.host, thingTypeId)
r = ... |
Delete an existing thing. It accepts thingTypeId ( string ) and thingId ( string ) as parameters In case of failure it throws APIException | def removeThing(self, thingTypeId, thingId):
"""
Delete an existing thing.
It accepts thingTypeId (string) and thingId (string) as parameters
In case of failure it throws APIException
"""
thingUrl = ApiClient.thingUrl % (self.host, thingTypeId, thingId)
r = reque... |
Creates a thing type. It accepts thingTypeId ( string ) name ( string ) description ( string ) schemaId ( string ) and metadata ( dict ) as parameter In case of failure it throws APIException | def addDraftThingType(self, thingTypeId, name = None, description = None, schemaId = None, metadata = None):
"""
Creates a thing type.
It accepts thingTypeId (string), name (string), description (string), schemaId(string) and metadata(dict) as parameter
In case of failure it throws APIEx... |
Updates a thing type. It accepts thingTypeId ( string ) name ( string ) description ( string ) schemaId ( string ) and metadata ( JSON ) as the parameters In case of failure it throws APIException | def updateDraftThingType(self, thingTypeId, name, description, schemaId, metadata = None):
"""
Updates a thing type.
It accepts thingTypeId (string), name (string), description (string), schemaId (string) and metadata(JSON) as the parameters
In case of failure it throws APIException
... |
Retrieves all existing draft thing types. It accepts accepts an optional query parameters ( Dictionary ) In case of failure it throws APIException | def getDraftThingTypes(self, parameters = None):
"""
Retrieves all existing draft thing types.
It accepts accepts an optional query parameters (Dictionary)
In case of failure it throws APIException
"""
draftThingTypesUrl = ApiClient.draftThingTypesUrl % (self.host)
... |
Retrieves all existing draft thing types. It accepts accepts an optional query parameters ( Dictionary ) In case of failure it throws APIException | def getDraftThingType(self, thingTypeId, parameters = None):
"""
Retrieves all existing draft thing types.
It accepts accepts an optional query parameters (Dictionary)
In case of failure it throws APIException
"""
draftThingTypeUrl = ApiClient.draftThingTypeUrl % (self.ho... |
Deletes a Thing type. It accepts thingTypeId ( string ) as the parameter In case of failure it throws APIException | def deleteDraftThingType(self, thingTypeId):
"""
Deletes a Thing type.
It accepts thingTypeId (string) as the parameter
In case of failure it throws APIException
"""
draftThingTypeUrl = ApiClient.draftThingTypeUrl % (self.host, thingTypeId)
r = requests.delete(dr... |
Create a schema for the org. Returns: schemaId ( string ) response ( object ). Throws APIException on failure | def createSchema(self, schemaName, schemaFileName, schemaContents, description=None):
"""
Create a schema for the org.
Returns: schemaId (string), response (object).
Throws APIException on failure
"""
req = ApiClient.allSchemasUrl % (self.host, "/draft")
fields={
... |
Delete a schema. Parameter: schemaId ( string ). Throws APIException on failure. | def deleteSchema(self, schemaId):
"""
Delete a schema. Parameter: schemaId (string). Throws APIException on failure.
"""
req = ApiClient.oneSchemaUrl % (self.host, "/draft", schemaId)
resp = requests.delete(req, auth=self.credentials, verify=self.verify)
if resp.status_c... |
Update a schema. Throws APIException on failure. | def updateSchema(self, schemaId, schemaDefinition):
"""
Update a schema. Throws APIException on failure.
"""
req = ApiClient.oneSchemaUrl % (self.host, "/draft", schemaId)
body = {"schemaDefinition": schemaDefinition}
resp = requests.put(req, auth=self.credentials, header... |
Get the content for a schema. Parameters: schemaId ( string ) draft ( boolean ). Throws APIException on failure. | def getSchemaContent(self, schemaId, draft=False):
"""
Get the content for a schema. Parameters: schemaId (string), draft (boolean). Throws APIException on failure.
"""
if draft:
req = ApiClient.oneSchemaContentUrl % (self.host, "/draft", schemaId)
else:
... |
Updates the content for a schema. Parameters: schemaId ( string ). Throws APIException on failure. | def updateSchemaContent(self, schemaId, schemaFile):
"""
Updates the content for a schema. Parameters: schemaId (string). Throws APIException on failure.
"""
req = ApiClient.oneSchemaContentUrl % (self.host, "/draft", schemaId)
body = {"schemaFile": schemaFile}
resp = re... |
Updates an event type. Parameters: eventTypeId ( string ) name ( string ) schemaId ( string ) description ( string optional ). Throws APIException on failure. | def updateEventType(self, eventTypeId, name, schemaId, description=None):
"""
Updates an event type.
Parameters: eventTypeId (string), name (string), schemaId (string), description (string, optional).
Throws APIException on failure.
"""
req = ApiClient.oneEventTypesUrl % ... |
Deletes an event type. Parameters: eventTypeId ( string ). Throws APIException on failure. | def deleteEventType(self, eventTypeId):
"""
Deletes an event type. Parameters: eventTypeId (string). Throws APIException on failure.
"""
req = ApiClient.oneEventTypeUrl % (self.host, "/draft", eventTypeId)
resp = requests.delete(req, auth=self.credentials, verify=self.verify)
... |
Gets an event type. Parameters: eventTypeId ( string ) draft ( boolean ). Throws APIException on failure. | def getEventType(self, eventTypeId, draft=False):
"""
Gets an event type. Parameters: eventTypeId (string), draft (boolean). Throws APIException on failure.
"""
if draft:
req = ApiClient.oneEventTypeUrl % (self.host, "/draft", eventTypeId)
else:
req = Ap... |
Create a physical interface. Parameters: - name ( string ) - description ( string optional ) Returns: physical interface id response. Throws APIException on failure. | def createPhysicalInterface(self, name, description=None):
"""
Create a physical interface.
Parameters:
- name (string)
- description (string, optional)
Returns: physical interface id, response.
Throws APIException on failure.
"""
req = ApiClie... |
Update a physical interface. Parameters: - physicalInterfaceId ( string ) - name ( string ) - schemaId ( string ) - description ( string optional ) Throws APIException on failure. | def updatePhysicalInterface(self, physicalInterfaceId, name, schemaId, description=None):
"""
Update a physical interface.
Parameters:
- physicalInterfaceId (string)
- name (string)
- schemaId (string)
- description (string, optional)
Throws APIExc... |
Delete a physical interface. Parameters: physicalInterfaceId ( string ). Throws APIException on failure. | def deletePhysicalInterface(self, physicalInterfaceId):
"""
Delete a physical interface.
Parameters: physicalInterfaceId (string).
Throws APIException on failure.
"""
req = ApiClient.onePhysicalInterfaceUrl % (self.host, "/draft", physicalInterfaceId)
resp = reque... |
Get a physical interface. Parameters: - physicalInterfaceId ( string ) - draft ( boolean ) Throws APIException on failure. | def getPhysicalInterface(self, physicalInterfaceId, draft=False):
"""
Get a physical interface.
Parameters:
- physicalInterfaceId (string)
- draft (boolean)
Throws APIException on failure.
"""
if draft:
req = ApiClient.onePhysicalInterfaceU... |
Create an event mapping for a physical interface. Parameters: physicalInterfaceId ( string ) - value returned by the platform when creating the physical interface eventTypeId ( string ) - value returned by the platform when creating the event type eventId ( string ) - matches the event id used by the device in the MQTT... | def createEvent(self, physicalInterfaceId, eventTypeId, eventId):
"""
Create an event mapping for a physical interface.
Parameters:
physicalInterfaceId (string) - value returned by the platform when creating the physical interface
eventTypeId (string) - value returned by the ... |
Delete an event mapping from a physical interface. Parameters: physicalInterfaceId ( string ) eventId ( string ). Throws APIException on failure. | def deleteEvent(self, physicalInterfaceId, eventId):
"""
Delete an event mapping from a physical interface.
Parameters: physicalInterfaceId (string), eventId (string).
Throws APIException on failure.
"""
req = ApiClient.oneEventUrl % (self.host, "/draft", physicalInterfac... |
Get all logical interfaces for an org. Parameters: draft ( boolean ). Returns: - list of ids - response object Throws APIException on failure. | def getLogicalInterfaces(self, draft=False, name=None, schemaId=None):
"""
Get all logical interfaces for an org.
Parameters: draft (boolean).
Returns:
- list of ids
- response object
Throws APIException on failure.
"""
if draft:
... |
Updates a logical interface. Parameters: logicalInterfaceId ( string ) name ( string ) schemaId ( string ) description ( string optional ). Throws APIException on failure. | def updateLogicalInterface(self, logicalInterfaceId, name, schemaId, description=None):
"""
Updates a logical interface.
Parameters: logicalInterfaceId (string), name (string), schemaId (string), description (string, optional).
Throws APIException on failure.
"""
req = Ap... |
Deletes a logical interface. Parameters: logicalInterfaceId ( string ). Throws APIException on failure. | def deleteLogicalInterface(self, logicalInterfaceId):
"""
Deletes a logical interface.
Parameters: logicalInterfaceId (string).
Throws APIException on failure.
"""
req = ApiClient.oneLogicalInterfaceUrl % (self.host, "/draft", logicalInterfaceId)
resp = requests.d... |
Gets a logical interface. Parameters: - logicalInterfaceId ( string ) - draft ( boolean ) Throws APIException on failure. | def getLogicalInterface(self, logicalInterfaceId, draft=False):
"""
Gets a logical interface.
Parameters:
- logicalInterfaceId (string)
- draft (boolean)
Throws APIException on failure.
"""
if draft:
req = ApiClient.oneLogicalInterfaceUrl %... |
Gets a rule for a logical interface. Parameters: - logicalInterfaceId ( string ) - ruleId ( string ) - draft ( boolean ) Throws APIException on failure. | def getRuleForLogicalInterface(self, logicalInterfaceId, ruleId, draft=False):
"""
Gets a rule for a logical interface.
Parameters:
- logicalInterfaceId (string)
- ruleId (string)
- draft (boolean)
Throws APIException on failure.
"""
if draft... |
Adds a rule to a logical interface. Parameters: - logicalInterfaceId ( string ) - name ( string ) - condition ( string ) - ( description ( string optional ) Returns: rule id ( string ) response ( object ). Throws APIException on failure. | def addRuleToLogicalInterface(self, logicalInterfaceId, name, condition, description=None, alias=None):
"""
Adds a rule to a logical interface.
Parameters:
- logicalInterfaceId (string)
- name (string)
- condition (string)
- (description (string, optional)... |
Updates a rule on a logical interface.. Parameters: - logicalInterfaceId ( string ) - ruleId ( string ) - name ( string ) - condition ( string ) - description ( string optional ) Returns: response ( object ). Throws APIException on failure. | def updateRuleOnLogicalInterface(self, logicalInterfaceId, ruleId, name, condition, description=None):
"""
Updates a rule on a logical interface..
Parameters:
- logicalInterfaceId (string),
- ruleId (string)
- name (string)
- condition (string)
-... |
Deletes a rule from a logical interface Parameters: - logicalInterfaceId ( string ) - ruleId ( string ) Returns: response ( object ) Throws APIException on failure | def deleteRuleOnLogicalInterface(self, logicalInterfaceId, ruleId):
"""
Deletes a rule from a logical interface
Parameters:
- logicalInterfaceId (string),
- ruleId (string)
Returns: response (object)
Throws APIException on failure
"""
req = Api... |
Adds a physical interface to a device type. Parameters: - typeId ( string ) - the device type - physicalInterfaceId ( string ) - the id returned by the platform on creation of the physical interface Throws APIException on failure. | def addPhysicalInterfaceToDeviceType(self, typeId, physicalInterfaceId):
"""
Adds a physical interface to a device type.
Parameters:
- typeId (string) - the device type
- physicalInterfaceId (string) - the id returned by the platform on creation of the physical interface
... |
Gets the physical interface associated with a device type. Parameters: - typeId ( string ) - the device type - draft ( boolean ) Throws APIException on failure. | def getPhysicalInterfaceOnDeviceType(self, typeId, draft=False):
"""
Gets the physical interface associated with a device type.
Parameters:
- typeId (string) - the device type
- draft (boolean)
Throws APIException on failure.
"""
if draft:
... |
Get all logical interfaces for a device type. Parameters: - typeId ( string ) - draft ( boolean ) Returns: - list of logical interface ids - HTTP response object Throws APIException on failure. | def getLogicalInterfacesOnDeviceType(self, typeId, draft=False):
"""
Get all logical interfaces for a device type.
Parameters:
- typeId (string)
- draft (boolean)
Returns:
- list of logical interface ids
- HTTP response object
Throws AP... |
Adds a logical interface to a device type. Parameters: - typeId ( string ) - the device type - logicalInterfaceId ( string ) - the id returned by the platform on creation of the logical interface - description ( string ) - optional ( not used ) Throws APIException on failure. | def addLogicalInterfaceToDeviceType(self, typeId, logicalInterfaceId):
"""
Adds a logical interface to a device type.
Parameters:
- typeId (string) - the device type
- logicalInterfaceId (string) - the id returned by the platform on creation of the logical interface
... |
Removes a logical interface from a device type. Parameters: - typeId ( string ) - the device type - logicalInterfaceId ( string ) - the id returned by the platform on creation of the logical interface Throws APIException on failure. | def removeLogicalInterfaceFromDeviceType(self, typeId, logicalInterfaceId):
"""
Removes a logical interface from a device type.
Parameters:
- typeId (string) - the device type
- logicalInterfaceId (string) - the id returned by the platform on creation of the logical inter... |
Get all the mappings for a device type. Parameters: - typeId ( string ) - the device type - draft ( boolean ) - draft or active Throws APIException on failure. | def getMappingsOnDeviceType(self, typeId, draft=False):
"""
Get all the mappings for a device type.
Parameters:
- typeId (string) - the device type
- draft (boolean) - draft or active
Throws APIException on failure.
"""
if draft:
req = ... |
Gets the mappings for a logical interface from a device type. Parameters: - typeId ( string ) - the device type - logicalInterfaceId ( string ) - the platform returned id of the logical interface Throws APIException on failure. | def getMappingsOnDeviceTypeForLogicalInterface(self, typeId, logicalInterfaceId, draft=False):
"""
Gets the mappings for a logical interface from a device type.
Parameters:
- typeId (string) - the device type
- logicalInterfaceId (string) - the platform returned id of the... |
Validate the device type configuration. Parameters: - typeId ( string ) - the platform device type Throws APIException on failure. | def validateDeviceTypeConfiguration(self, typeId):
"""
Validate the device type configuration.
Parameters:
- typeId (string) - the platform device type
Throws APIException on failure.
"""
req = ApiClient.draftDeviceTypeUrl % (self.host, typeId)
body = ... |
Validate the logical interface configuration. Parameters: - logicalInterfaceId ( string ) Throws APIException on failure. | def validateLogicalInterfaceConfiguration(self, logicalInterfaceId):
"""
Validate the logical interface configuration.
Parameters:
- logicalInterfaceId (string)
Throws APIException on failure.
"""
req = ApiClient.oneLogicalInterfaceUrl % (self.host, "/draft", ... |
Gets the state for a logical interface for a device. Parameters: - typeId ( string ) - the platform device type - deviceId ( string ) - the platform device id - logicalInterfaceId ( string ) - the platform returned id of the logical interface Throws APIException on failure. | def getDeviceStateForLogicalInterface(self, typeId, deviceId, logicalInterfaceId):
"""
Gets the state for a logical interface for a device.
Parameters:
- typeId (string) - the platform device type
- deviceId (string) - the platform device id
- logicalInterface... |
Gets the state for a logical interface for a thing. Parameters: - thingTypeId ( string ) - the platform thing type - thingId ( string ) - the platform thing id - logicalInterfaceId ( string ) - the platform returned id of the logical interface Throws APIException on failure. | def getThingStateForLogicalInterface(self, thingTypeId, thingId, logicalInterfaceId):
"""
Gets the state for a logical interface for a thing.
Parameters:
- thingTypeId (string) - the platform thing type
- thingId (string) - the platform thing id
- logicalInter... |
Perform an operation against the thing state for a logical interface Parameters: - thingTypeId ( string ) - thingId ( string ) - logicalInterfaceId ( string ) Throws APIException on failure. | def resetThingStateForLogicalInterface(self, thingTypeId, thingId , logicalInterfaceId):
"""
Perform an operation against the thing state for a logical interface
Parameters:
- thingTypeId (string)
- thingId (string)
- logicalInterfaceId (string)
Throws AP... |
Get all logical interfaces for a thing type. Parameters: - thingTypeId ( string ) - draft ( boolean ) Returns: - list of logical interface ids - HTTP response object Throws APIException on failure. | def getLogicalInterfacesOnThingType(self, thingTypeId, draft=False):
"""
Get all logical interfaces for a thing type.
Parameters:
- thingTypeId (string)
- draft (boolean)
Returns:
- list of logical interface ids
- HTTP response object
T... |
Adds a logical interface to a thing type. Parameters: - thingTypeId ( string ) - the thing type - logicalInterfaceId ( string ) - the id returned by the platform on creation of the logical interface Throws APIException on failure. | def addLogicalInterfaceToThingType(self, thingTypeId, logicalInterfaceId, schemaId = None, name = None):
"""
Adds a logical interface to a thing type.
Parameters:
- thingTypeId (string) - the thing type
- logicalInterfaceId (string) - the id returned by the platform on cr... |
Removes a logical interface from a thing type. Parameters: - thingTypeId ( string ) - the thing type - logicalInterfaceId ( string ) - the id returned by the platform on creation of the logical interface Throws APIException on failure. | def removeLogicalInterfaceFromThingType(self, thingTypeId, logicalInterfaceId):
"""
Removes a logical interface from a thing type.
Parameters:
- thingTypeId (string) - the thing type
- logicalInterfaceId (string) - the id returned by the platform on creation of the logica... |
Get all the mappings for a thing type. Parameters: - thingTypeId ( string ) - the thing type - draft ( boolean ) - draft or active Throws APIException on failure. | def getMappingsOnThingType(self, thingTypeId, draft=False):
"""
Get all the mappings for a thing type.
Parameters:
- thingTypeId (string) - the thing type
- draft (boolean) - draft or active
Throws APIException on failure.
"""
if draft:
... |
Gets the mappings for a logical interface from a thing type. Parameters: - thingTypeId ( string ) - the thing type - logicalInterfaceId ( string ) - the platform returned id of the logical interface Throws APIException on failure. | def getMappingsOnThingTypeForLogicalInterface(self, thingTypeId, logicalInterfaceId, draft=False):
"""
Gets the mappings for a logical interface from a thing type.
Parameters:
- thingTypeId (string) - the thing type
- logicalInterfaceId (string) - the platform returned id... |
Add mappings for a thing type. Parameters: - thingTypeId ( string ) - the thing type - logicalInterfaceId ( string ) - the id of the application interface these mappings are for - notificationStrategy ( string ) - the notification strategy to use for these mappings - mappingsObject ( Python dictionary corresponding to ... | def updateMappingsOnDeviceType(self, thingTypeId, logicalInterfaceId, mappingsObject, notificationStrategy = "never"):
"""
Add mappings for a thing type.
Parameters:
- thingTypeId (string) - the thing type
- logicalInterfaceId (string) - the id of the application interfac... |
Connect the client to IBM Watson IoT Platform using the underlying Paho MQTT client # Raises ConnectionException: If there is a problem establishing the connection. | def connect(self):
"""
Connect the client to IBM Watson IoT Platform using the underlying Paho MQTT client
# Raises
ConnectionException: If there is a problem establishing the connection.
"""
self.logger.debug(
"Connecting... (address = %s, port = %s,... |
Disconnect the client from IBM Watson IoT Platform | def disconnect(self):
"""
Disconnect the client from IBM Watson IoT Platform
"""
# self.logger.info("Closing connection to the IBM Watson IoT Platform")
self.client.disconnect()
# If we don't call loop_stop() it appears we end up with a zombie thread which continues to pr... |
Called when the client has log information. See [ paho. mqtt. python#on_log ] ( https:// github. com/ eclipse/ paho. mqtt. python#on_log ) for more information # Parameters mqttc ( paho. mqtt. client. Client ): The client instance for this callback obj ( object ): The private user data as set in Client () or user_data_... | def _onLog(self, mqttc, obj, level, string):
"""
Called when the client has log information.
See [paho.mqtt.python#on_log](https://github.com/eclipse/paho.mqtt.python#on_log) for more information
# Parameters
mqttc (paho.mqtt.client.Client): The client instanc... |
Called when the broker responds to our connection request. | def _onConnect(self, mqttc, userdata, flags, rc):
"""
Called when the broker responds to our connection request.
The value of rc determines success or not:
0: Connection successful
1: Connection refused - incorrect protocol version
2: Connection refused - inv... |
Called when the client disconnects from IBM Watson IoT Platform. See [ paho. mqtt. python#on_disconnect ] ( https:// github. com/ eclipse/ paho. mqtt. python#on_disconnect ) for more information # Parameters mqttc ( paho. mqtt. client. Client ): The client instance for this callback obj ( object ): The private user dat... | def _onDisconnect(self, mqttc, obj, rc):
"""
Called when the client disconnects from IBM Watson IoT Platform.
See [paho.mqtt.python#on_disconnect](https://github.com/eclipse/paho.mqtt.python#on_disconnect) for more information
# Parameters
mqttc (paho.mqtt.clien... |
Called when a message from the client has been successfully sent to IBM Watson IoT Platform. See [ paho. mqtt. python#on_publish ] ( https:// github. com/ eclipse/ paho. mqtt. python#on_publish ) for more information # Parameters mqttc ( paho. mqtt. client. Client ): The client instance for this callback obj ( object )... | def _onPublish(self, mqttc, obj, mid):
"""
Called when a message from the client has been successfully sent to IBM Watson IoT Platform.
See [paho.mqtt.python#on_publish](https://github.com/eclipse/paho.mqtt.python#on_publish) for more information
# Parameters
mq... |
Subscribe to device event messages | def subscribeToDeviceEvents(self, typeId="+", deviceId="+", eventId="+", msgFormat="+", qos=0):
"""
Subscribe to device event messages
# Parameters
typeId (string): typeId for the subscription, optional. Defaults to all device types (MQTT `+` wildcard)
deviceId (string): device... |
Subscribe to device status messages | def subscribeToDeviceStatus(self, typeId="+", deviceId="+"):
"""
Subscribe to device status messages
# Parameters
typeId (string): typeId for the subscription, optional. Defaults to all device types (MQTT `+` wildcard)
deviceId (string): deviceId for the subscription, optional.... |
Subscribe to device command messages | def subscribeToDeviceCommands(self, typeId="+", deviceId="+", commandId="+", msgFormat="+"):
"""
Subscribe to device command messages
# Parameters
typeId (string): typeId for the subscription, optional. Defaults to all device types (MQTT `+` wildcard)
deviceId (string): deviceI... |
Publish a command to a device | def publishCommand(self, typeId, deviceId, commandId, msgFormat, data=None, qos=0, on_publish=None):
"""
Publish a command to a device
# Parameters
typeId (string) : The type of the device this command is to be published to
deviceId (string): The id of the device this command is... |
Internal callback for messages that have not been handled by any of the specific internal callbacks these messages are not passed on to any user provided callback | def _onUnsupportedMessage(self, client, userdata, message):
"""
Internal callback for messages that have not been handled by any of the specific internal callbacks, these
messages are not passed on to any user provided callback
"""
self.logger.warning(
"Received messa... |
Internal callback for device event messages parses source device from topic string and passes the information on to the registerd device event callback | def _onDeviceEvent(self, client, userdata, pahoMessage):
"""
Internal callback for device event messages, parses source device from topic string and
passes the information on to the registerd device event callback
"""
try:
event = Event(pahoMessage, self._messageCodec... |
Internal callback for device status messages parses source device from topic string and passes the information on to the registerd device status callback | def _onDeviceStatus(self, client, userdata, pahoMessage):
"""
Internal callback for device status messages, parses source device from topic string and
passes the information on to the registerd device status callback
"""
try:
status = Status(pahoMessage)
s... |
Internal callback for application command messages parses source application from topic string and passes the information on to the registerd applicaion status callback | def _onAppStatus(self, client, userdata, pahoMessage):
"""
Internal callback for application command messages, parses source application from topic string and
passes the information on to the registerd applicaion status callback
"""
try:
status = Status(pahoMessage)
... |
Parse environment variables into a Python dictionary suitable for passing to the device client constructor as the options parameter | def parseEnvVars():
"""
Parse environment variables into a Python dictionary suitable for passing to the
device client constructor as the `options` parameter
- `WIOTP_IDENTITY_ORGID`
- `WIOTP_IDENTITY_TYPEID`
- `WIOTP_IDENTITY_DEVICEID`
- `WIOTP_AUTH_TOKEN`
- `WIOTP_OPTIONS_DOMAIN` (opt... |
Retrieves the last cached message for specified event from a specific device. | def get(self, deviceUid, eventId):
"""
Retrieves the last cached message for specified event from a specific device.
"""
if not isinstance(deviceUid, DeviceUid) and isinstance(deviceUid, dict):
deviceUid = DeviceUid(**deviceUid)
url = "api/v0002/device/types/%s/devi... |
Retrieves a list of the last cached message for all events from a specific device. | def getAll(self, deviceUid):
"""
Retrieves a list of the last cached message for all events from a specific device.
"""
if not isinstance(deviceUid, DeviceUid) and isinstance(deviceUid, dict):
deviceUid = DeviceUid(**deviceUid)
url = "api/v0002/device/types/%s/devic... |
Retrieve bulk devices It accepts accepts a list of parameters In case of failure it throws Exception | def _makeApiCall(self, parameters=None):
"""
Retrieve bulk devices
It accepts accepts a list of parameters
In case of failure it throws Exception
"""
r = self._apiClient.get(self._url, parameters)
if r.status_code == 200:
return r.json()
else:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.