Пример #1
0
 def publish_operation_step_response(content, device_id, name, result, close_operation):
     step_response = operation_step_response(content, name, result, close_operation)
     step_response_as_json = json.dumps(step_response, indent=2)
     print 'Publishing {0} step status {1}...'.format(name, result)
     print step_response_as_json
     ws.send(step_response_as_json)
     print '...done'
 def publish_operation_step_response(content, device_id, name, result, close_operation):
     step_response = operation_step_response(content, name, result, close_operation)
     step_response_as_json = json.dumps(step_response, indent=2)
     print 'Publishing {0} step status {1}...'.format(name, result)
     print step_response_as_json
     ws.send(step_response_as_json)
     print '...done'
 def publish_operation_step_response(content, device_id, name, result, close_operation):
     '''MQTT specific callback function to publish responses asynchronously'''
     step_response = operation_step_response(
         content, name, result, close_operation)
     step_response_as_json = json.dumps(step_response, indent=2)
     print('Publishing {0} step status {1}...'.format(name, result))
     print(step_response_as_json)
     caller_mqtt_client.publish(ODM_PUBLISH_RESPONSE_TOPIC.format(
         device_id), step_response_as_json, qos=1)
     print('...done')
def publish_operation_step_response(content, device_id, name, result, close_operation):
    ogapi_operation_response_uri = "{0}/devices/{1}/operation/response".format(conf.OG_SOUTH_API_BASE_URI, device_id)

    step_response = operation_step_response(content, name, result, close_operation)

    step_response_as_json = json.dumps(step_response, indent=2)

    print "Publishing {0} step status {1} to {2}...".format(name, result, ogapi_operation_response_uri)
    print step_response_as_json
    r = requests.post(ogapi_operation_response_uri, data=step_response_as_json, headers=conf.HEADERS, stream=True)
    print "...done"
 def publish_operation_step_response(content, device_id, name, result,
                                     close_operation):
     step_response = operation_step_response(content, name, result,
                                             close_operation)
     step_response_as_json = json.dumps(step_response, indent=2)
     print 'Publishing {0} step status {1}...'.format(name, result)
     print step_response_as_json
     client.publish(ODM_PUBLISH_RESPONSE_TOPIC.format(device_id),
                    step_response_as_json,
                    qos=1)
     print '...done'
Пример #6
0
def publish_operation_step_response(content, device_id, name, result,
                                    close_operation):
    ogapi_operation_response_uri = '{0}/devices/{1}/operation/response'.format(
        conf.OG_SOUTH_API_BASE_URI, device_id)

    step_response = operation_step_response(content, name, result,
                                            close_operation)

    step_response_as_json = json.dumps(step_response, indent=2)

    print 'Publishing {0} step status {1} to {2}...'.format(
        name, result, ogapi_operation_response_uri)
    print step_response_as_json
    r = requests.post(ogapi_operation_response_uri,
                      data=step_response_as_json,
                      headers=conf.HEADERS,
                      stream=True)
    print '...done'