IBM流式Internet协议集成
streamsx.inet的Python项目详细描述
概述
提供运行http请求的函数。
此包将com.ibm.streamsx.inet工具包公开为python方法,用于上的流分析服务 ibm cloud和ibm streams,包括ibmcloud-pak for data。
样品
发出http请求的streams应用程序的一个简单示例:
from streamsx.topology.topology import * from streamsx.topology.schema import CommonSchema, StreamSchema from streamsx.topology.context import submit import streamsx.inet as inet topo = Topology() # HTTP GET REQUEST s1 = topo.source(['http://httpbin.org/get']).as_string() result_http_get = inet.request_get(s1) result_http_get.print() # HTTP PUT REQUEST s2 = topo.source(['hello world']).as_string() result_http_put = inet.request_put(s2, url='http://httpbin.org/put', content_type='text/plain') result_http_put.print() submit('STREAMING_ANALYTICS_SERVICE', topo) # Use for IBM Streams including IBM Cloud Pak for Data # submit ('DISTRIBUTED', topo)