本文整理汇总了Python中mod.session.SESSION.get_hardware方法的典型用法代码示例。如果您正苦于以下问题:Python SESSION.get_hardware方法的具体用法?Python SESSION.get_hardware怎么用?Python SESSION.get_hardware使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mod.session.SESSION
的用法示例。
在下文中一共展示了SESSION.get_hardware方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: from mod.session import SESSION [as 别名]
# 或者: from mod.session.SESSION import get_hardware [as 别名]
def index(self):
context = {}
with open(DEFAULT_ICON_TEMPLATE, 'r') as fd:
default_icon_template = tornado.escape.squeeze(fd.read().replace("'", "\\'"))
with open(DEFAULT_SETTINGS_TEMPLATE, 'r') as fd:
default_settings_template = tornado.escape.squeeze(fd.read().replace("'", "\\'"))
context = {
'default_icon_template': default_icon_template,
'default_settings_template': default_settings_template,
'cloud_url': CLOUD_HTTP_ADDRESS,
'hardware_profile': b64encode(json.dumps(SESSION.get_hardware()).encode("utf-8")),
'max_screenshot_width': MAX_SCREENSHOT_WIDTH,
'max_screenshot_height': MAX_SCREENSHOT_HEIGHT,
'package_server_address': PACKAGE_SERVER_ADDRESS or '',
'default_package_server_port': DEFAULT_PACKAGE_SERVER_PORT,
'package_repository': PACKAGE_REPOSITORY,
'js_custom_channel': 'true' if JS_CUSTOM_CHANNEL else 'false',
'auto_cloud_backup': 'true' if AUTO_CLOUD_BACKUP else 'false',
'avatar_url': AVATAR_URL,
'version': self.get_argument('v'),
'bundlepath': json.dumps(SESSION.bundlepath),
'title': json.dumps(SESSION.title),
'fulltitle': SESSION.title or "Untitled",
'using_app': json.dumps(APP),
'using_desktop': json.dumps(DESKTOP),
}
return context
示例2: get
# 需要导入模块: from mod.session import SESSION [as 别名]
# 或者: from mod.session.SESSION import get_hardware [as 别名]
def get(self):
hardware = SESSION.get_hardware()
self.set_header('Content-Type', 'application/json')
self.write(json.dumps(hardware))