本文整理汇总了Python中Engine.registerUser方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.registerUser方法的具体用法?Python Engine.registerUser怎么用?Python Engine.registerUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine.registerUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Engine
# 需要导入模块: import Engine [as 别名]
# 或者: from Engine import registerUser [as 别名]
from Engine import *
print "Testing SicsthSense python module and autocreation of Streams and Parsers"
# Create the ENgine module giving the running instance's hostname and port
e = Engine("localhost:8080")
#e = Engine("presense.sics.se:8080")
print "Hostname: "+e.hostname
registerNewUser=False
if registerNewUser:
# generate a random username
username = "newuser"+str(random.randint(0,99))
# register with SicsthSense
newUserJSONStr = e.registerUser('{"username": "'+username+'", "email":"'+username+'@anon.com"}')
# parse the returned JSON
newUserJSON = json.loads(newUserJSONStr)
# record our unique user ID
newUserId = newUserJSON["id"]
# record the new authentication token/key we have been given
key = newUserJSON["token"]
else:
# User existing user details
newUserId = 1
key = "4cb13dfc-b34e-4411-982b-2a0137162aa1"
# Configure our user ID and user Key