本文整理汇总了Python中cocaine.services.Service.read方法的典型用法代码示例。如果您正苦于以下问题:Python Service.read方法的具体用法?Python Service.read怎么用?Python Service.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocaine.services.Service
的用法示例。
在下文中一共展示了Service.read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: raw
# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import read [as 别名]
def raw(request, response):
inc = yield request.read()
goapp = Service("gococaine")
storage = Service("storage")
# Send data to the go application
response.write("Send data to the go application")
key = yield goapp.enqueue("process", str(inc))
response.write("Data was processed and saved to the storage, key: %s" % key)
# Read data from storage
res = yield storage.read("namespace", key)
response.write(res)
response.close()
示例2: read
# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import read [as 别名]
def read(request, response):
key = yield request.read()
storage = Service("storage")
data = yield storage.read("namespace", key)
response.write(data)
response.close()