本文整理汇总了Python中Engine.createParser方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.createParser方法的具体用法?Python Engine.createParser怎么用?Python Engine.createParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine.createParser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import createParser [as 别名]
manualCreation=True
if manualCreation:
# Create streams in resource
print "Making streams..."
newstream = { "description": "input1" }
streamjsonstr = json.dumps(newstream)
#print streamjsonstr
streamId = e.createStream(resourceId,streamjsonstr)
print "Made antecedent stream: "+str(streamId)+" - "+streamjsonstr;
# Create a Parser for this resource
newparser = { "stream_id":streamId, "input_parser":"/tets" }
parserjsonstr = json.dumps(newparser)
#print parserjsonstr
newId = e.createParser(resourceId,parserjsonstr)
print "new parser ID: "+str(newId);
postData=True
if postData:
print "Posting data..."
# POST 10 data items to created stream
for x in range(0,10):
#data = {"value": str(random.randint(0,99))}
#result = e.postStreamData(resourceId,antStreamId1,json.dumps(data))
data = {"value": str(random.randint(0,99))}
result = e.postStreamData(resourceId,streamId,json.dumps(data))
print str(data)+" -> "+str(result)
#print json.dumps(json.loads(result), sort_keys = False, indent = 4)
time.sleep(2)