Choosing an Output Channel
Prepare channels before outputting task results to DIS channels or webhook URLs.
Creating a DIS Stream
If Output Mode is set to DIS for a task, ensure that a DIS stream is available. For how to create a DIS stream, see Creating a DIS Stream.
Starting a Webhook Service
If Output Mode is set to Webhook for a task, ensure that a webhook service has been started.
The following uses a simple Python script as an example to describe how to start a webhook service and save the received data.
- Prepare a local Linux server, ensure that the network between the Linux server and the edge node server is normal, and install the Python environment.
- Run the ifconfig command on the Linux server to obtain the IP address.
- Enter the IP address of the Linux server in line 18 of the script.
Figure 1 Script example post.py
import json from wsgiref.simple_server import make_server def application(environ, start_response): start_response('200 OK', [('Content-Type', 'application/json')]) request_body = environ["wsgi.input"].read(int(environ.get("CONTENT_LENGTH", 0))) f=open('./post.txt','a') f.write(request_body) f.write("\n") f.close() return ("200 success\n") if __name__ == "__main__": port = 6006 httpd = make_server("10.10.10.1", port, application) print "serving http on port {0}...".format(str(port)) httpd.serve_forever()
You can change the port number 6006 in the script.
When creating a task, set the webhook URL to http://${IP address}:${Port}, for example, http://10.10.10.1:6006.
- Execute the script python post.py to start the webhook service.
Figure 2 Script executed
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot