本文整理汇总了Python中jsonrpclib.Server.methodHelp方法的典型用法代码示例。如果您正苦于以下问题:Python Server.methodHelp方法的具体用法?Python Server.methodHelp怎么用?Python Server.methodHelp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsonrpclib.Server
的用法示例。
在下文中一共展示了Server.methodHelp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from jsonrpclib import Server [as 别名]
# 或者: from jsonrpclib.Server import methodHelp [as 别名]
def main():
if len(sys.argv) > 1:
if sys.argv[1] == 'runserver':
from runner import initRPC
# Start server from here
initRPC()
elif sys.argv[1] == 'start_component':
from core.manager.execute_start_component import start_component
# Create component
start_component(sys.argv[2])
elif sys.argv[1] == 'shutdown':
from jsonrpclib import Server
from socket import error
from config.settings import CORE_PORT
try:
conn = Server('http://localhost:{0}'.format(CORE_PORT))
conn.main.stop()
except error:
print 'Core Services shutdown \t\t\t\t\t\t[OK]'
elif sys.argv[1] == 'set_index':
second_cmd = sys.argv[2]
from pymongo import MongoClient
from pymongo import ASCENDING
from config.settings import MONGO_HOST_LOCAL
from config.settings import MONGO_PORT_LOCAL
url = "mongodb://{0}".format(MONGO_HOST_LOCAL)
url += ":{0}".format(MONGO_PORT_LOCAL)
cursor = MongoClient(url)['YouTube']['refined_data']
if second_cmd == 'show':
print cursor.index_information()
elif second_cmd == 'write':
cursor.create_index([('id', ASCENDING)], unique=True)
elif sys.argv[1] == 'logs':
from os import system
from config.settings import CORE_ID
system('tail -f /var/log/core/{0}/*'.format(CORE_ID))
elif sys.argv[1] == 'memory':
from jsonrpclib import Server
from socket import error
from config.settings import CORE_PORT
try:
key = sys.argv[2]
conn = Server('http://localhost:{0}'.format(CORE_PORT))
data = conn.main.access_shared_memory(key)
pretty(data)
except error:
print 'Core Services shutdown \t\t\t\t\t\t[OK]'
elif sys.argv[1] == 'generate_settings':
from shutil import copyfile
from config.settings import BASE_DIR
raw = BASE_DIR + '/config/settings_local.txt'
gen = BASE_DIR + '/config/settings_local.py'
copyfile(raw, gen)
elif sys.argv[1] == 'plugin':
from jsonrpclib import Server
from socket import error
from config.settings import CORE_PORT
try:
conn = Server('http://localhost:{0}'.format(CORE_PORT))
data = conn.listMethods()
pretty(dumps(data))
except error:
print 'Core Services shutdown \t\t\t\t\t\t[OK]'
elif sys.argv[1] == 'help':
if len(sys.argv) == 3:
from os import system
from jsonrpclib import Server
from socket import error
from config.settings import CORE_PORT
try:
conn = Server('http://localhost:{0}'.format(CORE_PORT))
data = conn.methodHelp(sys.argv[2])
system('echo {}'.format(data))
#.........这里部分代码省略.........