#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.13.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

import sys
import pprint
if sys.version_info[0] > 2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse
from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocol

from EACPLog import ncTEACPLog
from EACPLog.ttypes import *

if len(sys.argv) <= 1 or sys.argv[1] == '--help':
    print('')
    print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]')
    print('')
    print('Functions:')
    print('  void Log(ncTLogItem item)')
    print('  ncTLogCountInfo GetLogCount(ncTGetLogCountParam param)')
    print('   GetPageLog(ncTGetPageLogParam param)')
    print('  string ExportLog(ncTExportLogParam param)')
    print('  void SetLogRetentionPeriod(i32 period)')
    print('  i32 GetLogRetentionPeriod()')
    print('   GetHistoryLogs(ncTLogType logType)')
    print('  i64 GetHistoryLogCount(ncTGetHistoryLogCountParam param)')
    print('   GetPageHistoryLog(ncTGetPageHistoryLogParam param)')
    print('  ncTEVFSOSSRequest GetHistoryLogDownLoadInfo(string id, string reqHost, bool useHttps, i64 validSeconds)')
    print('  string ReadHistoryLog(string fileId, i64 offset, i32 length)')
    print('  ncTLogSpaceInfo GetLogSpaceInfo()')
    print('   GetBufferedLogs()')
    print('  void SetSyslogFirstPushTime(i64 time)')
    print('  void SetLogPushPeriod(i32 period)')
    print('  i32 GetLogPushPeriod()')
    print('')
    sys.exit(0)

pp = pprint.PrettyPrinter(indent=2)
host = 'localhost'
port = 9090
uri = ''
framed = False
ssl = False
validate = True
ca_certs = None
keyfile = None
certfile = None
http = False
argi = 1

if sys.argv[argi] == '-h':
    parts = sys.argv[argi + 1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    argi += 2

if sys.argv[argi] == '-u':
    url = urlparse(sys.argv[argi + 1])
    parts = url[1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    else:
        port = 80
    uri = url[2]
    if url[4]:
        uri += '?%s' % url[4]
    http = True
    argi += 2

if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
    framed = True
    argi += 1

if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
    ssl = True
    argi += 1

if sys.argv[argi] == '-novalidate':
    validate = False
    argi += 1

if sys.argv[argi] == '-ca_certs':
    ca_certs = sys.argv[argi+1]
    argi += 2

if sys.argv[argi] == '-keyfile':
    keyfile = sys.argv[argi+1]
    argi += 2

if sys.argv[argi] == '-certfile':
    certfile = sys.argv[argi+1]
    argi += 2

cmd = sys.argv[argi]
args = sys.argv[argi + 1:]

if http:
    transport = THttpClient.THttpClient(host, port, uri)
else:
    if ssl:
        socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
    else:
        socket = TSocket.TSocket(host, port)
    if framed:
        transport = TTransport.TFramedTransport(socket)
    else:
        transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol(transport)
client = ncTEACPLog.Client(protocol)
transport.open()

if cmd == 'Log':
    if len(args) != 1:
        print('Log requires 1 args')
        sys.exit(1)
    pp.pprint(client.Log(eval(args[0]),))

elif cmd == 'GetLogCount':
    if len(args) != 1:
        print('GetLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetLogCount(eval(args[0]),))

elif cmd == 'GetPageLog':
    if len(args) != 1:
        print('GetPageLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageLog(eval(args[0]),))

elif cmd == 'ExportLog':
    if len(args) != 1:
        print('ExportLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.ExportLog(eval(args[0]),))

elif cmd == 'SetLogRetentionPeriod':
    if len(args) != 1:
        print('SetLogRetentionPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogRetentionPeriod(eval(args[0]),))

elif cmd == 'GetLogRetentionPeriod':
    if len(args) != 0:
        print('GetLogRetentionPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogRetentionPeriod())

elif cmd == 'GetHistoryLogs':
    if len(args) != 1:
        print('GetHistoryLogs requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogs(eval(args[0]),))

elif cmd == 'GetHistoryLogCount':
    if len(args) != 1:
        print('GetHistoryLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogCount(eval(args[0]),))

elif cmd == 'GetPageHistoryLog':
    if len(args) != 1:
        print('GetPageHistoryLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageHistoryLog(eval(args[0]),))

elif cmd == 'GetHistoryLogDownLoadInfo':
    if len(args) != 4:
        print('GetHistoryLogDownLoadInfo requires 4 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogDownLoadInfo(args[0], args[1], eval(args[2]), eval(args[3]),))

elif cmd == 'ReadHistoryLog':
    if len(args) != 3:
        print('ReadHistoryLog requires 3 args')
        sys.exit(1)
    pp.pprint(client.ReadHistoryLog(args[0], eval(args[1]), eval(args[2]),))

elif cmd == 'GetLogSpaceInfo':
    if len(args) != 0:
        print('GetLogSpaceInfo requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogSpaceInfo())

elif cmd == 'GetBufferedLogs':
    if len(args) != 0:
        print('GetBufferedLogs requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetBufferedLogs())

elif cmd == 'SetSyslogFirstPushTime':
    if len(args) != 1:
        print('SetSyslogFirstPushTime requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetSyslogFirstPushTime(eval(args[0]),))

elif cmd == 'SetLogPushPeriod':
    if len(args) != 1:
        print('SetLogPushPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogPushPeriod(eval(args[0]),))

elif cmd == 'GetLogPushPeriod':
    if len(args) != 0:
        print('GetLogPushPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogPushPeriod())

else:
    print('Unrecognized method %s' % cmd)
    sys.exit(1)

transport.close()

04bd6f89e13b83d87fcf57da738d5eac40c008f6
<mask token>

<mask token>
if sys.version_info[0] > 2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse
<mask token>
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
    print('')
    print('Usage: ' + sys.argv[0] +
        ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]'
        )
    print('')
    print('Functions:')
    print('  void Log(ncTLogItem item)')
    print('  ncTLogCountInfo GetLogCount(ncTGetLogCountParam param)')
    print('   GetPageLog(ncTGetPageLogParam param)')
    print('  string ExportLog(ncTExportLogParam param)')
    print('  void SetLogRetentionPeriod(i32 period)')
    print('  i32 GetLogRetentionPeriod()')
    print('   GetHistoryLogs(ncTLogType logType)')
    print('  i64 GetHistoryLogCount(ncTGetHistoryLogCountParam param)')
    print('   GetPageHistoryLog(ncTGetPageHistoryLogParam param)')
    print(
        '  ncTEVFSOSSRequest GetHistoryLogDownLoadInfo(string id, string reqHost, bool useHttps, i64 validSeconds)'
        )
    print('  string ReadHistoryLog(string fileId, i64 offset, i32 length)')
    print('  ncTLogSpaceInfo GetLogSpaceInfo()')
    print('   GetBufferedLogs()')
    print('  void SetSyslogFirstPushTime(i64 time)')
    print('  void SetLogPushPeriod(i32 period)')
    print('  i32 GetLogPushPeriod()')
    print('')
    sys.exit(0)
<mask token>
if sys.argv[argi] == '-h':
    parts = sys.argv[argi + 1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    argi += 2
if sys.argv[argi] == '-u':
    url = urlparse(sys.argv[argi + 1])
    parts = url[1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    else:
        port = 80
    uri = url[2]
    if url[4]:
        uri += '?%s' % url[4]
    http = True
    argi += 2
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
    framed = True
    argi += 1
if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
    ssl = True
    argi += 1
if sys.argv[argi] == '-novalidate':
    validate = False
    argi += 1
if sys.argv[argi] == '-ca_certs':
    ca_certs = sys.argv[argi + 1]
    argi += 2
if sys.argv[argi] == '-keyfile':
    keyfile = sys.argv[argi + 1]
    argi += 2
if sys.argv[argi] == '-certfile':
    certfile = sys.argv[argi + 1]
    argi += 2
<mask token>
if http:
    transport = THttpClient.THttpClient(host, port, uri)
else:
    if ssl:
        socket = TSSLSocket.TSSLSocket(host, port, validate=validate,
            ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
    else:
        socket = TSocket.TSocket(host, port)
    if framed:
        transport = TTransport.TFramedTransport(socket)
    else:
        transport = TTransport.TBufferedTransport(socket)
<mask token>
transport.open()
if cmd == 'Log':
    if len(args) != 1:
        print('Log requires 1 args')
        sys.exit(1)
    pp.pprint(client.Log(eval(args[0])))
elif cmd == 'GetLogCount':
    if len(args) != 1:
        print('GetLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetLogCount(eval(args[0])))
elif cmd == 'GetPageLog':
    if len(args) != 1:
        print('GetPageLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageLog(eval(args[0])))
elif cmd == 'ExportLog':
    if len(args) != 1:
        print('ExportLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.ExportLog(eval(args[0])))
elif cmd == 'SetLogRetentionPeriod':
    if len(args) != 1:
        print('SetLogRetentionPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogRetentionPeriod(eval(args[0])))
elif cmd == 'GetLogRetentionPeriod':
    if len(args) != 0:
        print('GetLogRetentionPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogRetentionPeriod())
elif cmd == 'GetHistoryLogs':
    if len(args) != 1:
        print('GetHistoryLogs requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogs(eval(args[0])))
elif cmd == 'GetHistoryLogCount':
    if len(args) != 1:
        print('GetHistoryLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogCount(eval(args[0])))
elif cmd == 'GetPageHistoryLog':
    if len(args) != 1:
        print('GetPageHistoryLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageHistoryLog(eval(args[0])))
elif cmd == 'GetHistoryLogDownLoadInfo':
    if len(args) != 4:
        print('GetHistoryLogDownLoadInfo requires 4 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogDownLoadInfo(args[0], args[1], eval(args[
        2]), eval(args[3])))
elif cmd == 'ReadHistoryLog':
    if len(args) != 3:
        print('ReadHistoryLog requires 3 args')
        sys.exit(1)
    pp.pprint(client.ReadHistoryLog(args[0], eval(args[1]), eval(args[2])))
elif cmd == 'GetLogSpaceInfo':
    if len(args) != 0:
        print('GetLogSpaceInfo requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogSpaceInfo())
elif cmd == 'GetBufferedLogs':
    if len(args) != 0:
        print('GetBufferedLogs requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetBufferedLogs())
elif cmd == 'SetSyslogFirstPushTime':
    if len(args) != 1:
        print('SetSyslogFirstPushTime requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetSyslogFirstPushTime(eval(args[0])))
elif cmd == 'SetLogPushPeriod':
    if len(args) != 1:
        print('SetLogPushPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogPushPeriod(eval(args[0])))
elif cmd == 'GetLogPushPeriod':
    if len(args) != 0:
        print('GetLogPushPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogPushPeriod())
else:
    print('Unrecognized method %s' % cmd)
    sys.exit(1)
transport.close()

<mask token>
if sys.version_info[0] > 2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse
<mask token>
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
    print('')
    print('Usage: ' + sys.argv[0] +
        ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]'
        )
    print('')
    print('Functions:')
    print('  void Log(ncTLogItem item)')
    print('  ncTLogCountInfo GetLogCount(ncTGetLogCountParam param)')
    print('   GetPageLog(ncTGetPageLogParam param)')
    print('  string ExportLog(ncTExportLogParam param)')
    print('  void SetLogRetentionPeriod(i32 period)')
    print('  i32 GetLogRetentionPeriod()')
    print('   GetHistoryLogs(ncTLogType logType)')
    print('  i64 GetHistoryLogCount(ncTGetHistoryLogCountParam param)')
    print('   GetPageHistoryLog(ncTGetPageHistoryLogParam param)')
    print(
        '  ncTEVFSOSSRequest GetHistoryLogDownLoadInfo(string id, string reqHost, bool useHttps, i64 validSeconds)'
        )
    print('  string ReadHistoryLog(string fileId, i64 offset, i32 length)')
    print('  ncTLogSpaceInfo GetLogSpaceInfo()')
    print('   GetBufferedLogs()')
    print('  void SetSyslogFirstPushTime(i64 time)')
    print('  void SetLogPushPeriod(i32 period)')
    print('  i32 GetLogPushPeriod()')
    print('')
    sys.exit(0)
pp = pprint.PrettyPrinter(indent=2)
host = 'localhost'
port = 9090
uri = ''
framed = False
ssl = False
validate = True
ca_certs = None
keyfile = None
certfile = None
http = False
argi = 1
if sys.argv[argi] == '-h':
    parts = sys.argv[argi + 1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    argi += 2
if sys.argv[argi] == '-u':
    url = urlparse(sys.argv[argi + 1])
    parts = url[1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    else:
        port = 80
    uri = url[2]
    if url[4]:
        uri += '?%s' % url[4]
    http = True
    argi += 2
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
    framed = True
    argi += 1
if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
    ssl = True
    argi += 1
if sys.argv[argi] == '-novalidate':
    validate = False
    argi += 1
if sys.argv[argi] == '-ca_certs':
    ca_certs = sys.argv[argi + 1]
    argi += 2
if sys.argv[argi] == '-keyfile':
    keyfile = sys.argv[argi + 1]
    argi += 2
if sys.argv[argi] == '-certfile':
    certfile = sys.argv[argi + 1]
    argi += 2
cmd = sys.argv[argi]
args = sys.argv[argi + 1:]
if http:
    transport = THttpClient.THttpClient(host, port, uri)
else:
    if ssl:
        socket = TSSLSocket.TSSLSocket(host, port, validate=validate,
            ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
    else:
        socket = TSocket.TSocket(host, port)
    if framed:
        transport = TTransport.TFramedTransport(socket)
    else:
        transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol(transport)
client = ncTEACPLog.Client(protocol)
transport.open()
if cmd == 'Log':
    if len(args) != 1:
        print('Log requires 1 args')
        sys.exit(1)
    pp.pprint(client.Log(eval(args[0])))
elif cmd == 'GetLogCount':
    if len(args) != 1:
        print('GetLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetLogCount(eval(args[0])))
elif cmd == 'GetPageLog':
    if len(args) != 1:
        print('GetPageLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageLog(eval(args[0])))
elif cmd == 'ExportLog':
    if len(args) != 1:
        print('ExportLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.ExportLog(eval(args[0])))
elif cmd == 'SetLogRetentionPeriod':
    if len(args) != 1:
        print('SetLogRetentionPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogRetentionPeriod(eval(args[0])))
elif cmd == 'GetLogRetentionPeriod':
    if len(args) != 0:
        print('GetLogRetentionPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogRetentionPeriod())
elif cmd == 'GetHistoryLogs':
    if len(args) != 1:
        print('GetHistoryLogs requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogs(eval(args[0])))
elif cmd == 'GetHistoryLogCount':
    if len(args) != 1:
        print('GetHistoryLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogCount(eval(args[0])))
elif cmd == 'GetPageHistoryLog':
    if len(args) != 1:
        print('GetPageHistoryLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageHistoryLog(eval(args[0])))
elif cmd == 'GetHistoryLogDownLoadInfo':
    if len(args) != 4:
        print('GetHistoryLogDownLoadInfo requires 4 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogDownLoadInfo(args[0], args[1], eval(args[
        2]), eval(args[3])))
elif cmd == 'ReadHistoryLog':
    if len(args) != 3:
        print('ReadHistoryLog requires 3 args')
        sys.exit(1)
    pp.pprint(client.ReadHistoryLog(args[0], eval(args[1]), eval(args[2])))
elif cmd == 'GetLogSpaceInfo':
    if len(args) != 0:
        print('GetLogSpaceInfo requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogSpaceInfo())
elif cmd == 'GetBufferedLogs':
    if len(args) != 0:
        print('GetBufferedLogs requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetBufferedLogs())
elif cmd == 'SetSyslogFirstPushTime':
    if len(args) != 1:
        print('SetSyslogFirstPushTime requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetSyslogFirstPushTime(eval(args[0])))
elif cmd == 'SetLogPushPeriod':
    if len(args) != 1:
        print('SetLogPushPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogPushPeriod(eval(args[0])))
elif cmd == 'GetLogPushPeriod':
    if len(args) != 0:
        print('GetLogPushPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogPushPeriod())
else:
    print('Unrecognized method %s' % cmd)
    sys.exit(1)
transport.close()

import sys
import pprint
if sys.version_info[0] > 2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse
from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
from EACPLog import ncTEACPLog
from EACPLog.ttypes import *
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
    print('')
    print('Usage: ' + sys.argv[0] +
        ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]'
        )
    print('')
    print('Functions:')
    print('  void Log(ncTLogItem item)')
    print('  ncTLogCountInfo GetLogCount(ncTGetLogCountParam param)')
    print('   GetPageLog(ncTGetPageLogParam param)')
    print('  string ExportLog(ncTExportLogParam param)')
    print('  void SetLogRetentionPeriod(i32 period)')
    print('  i32 GetLogRetentionPeriod()')
    print('   GetHistoryLogs(ncTLogType logType)')
    print('  i64 GetHistoryLogCount(ncTGetHistoryLogCountParam param)')
    print('   GetPageHistoryLog(ncTGetPageHistoryLogParam param)')
    print(
        '  ncTEVFSOSSRequest GetHistoryLogDownLoadInfo(string id, string reqHost, bool useHttps, i64 validSeconds)'
        )
    print('  string ReadHistoryLog(string fileId, i64 offset, i32 length)')
    print('  ncTLogSpaceInfo GetLogSpaceInfo()')
    print('   GetBufferedLogs()')
    print('  void SetSyslogFirstPushTime(i64 time)')
    print('  void SetLogPushPeriod(i32 period)')
    print('  i32 GetLogPushPeriod()')
    print('')
    sys.exit(0)
pp = pprint.PrettyPrinter(indent=2)
host = 'localhost'
port = 9090
uri = ''
framed = False
ssl = False
validate = True
ca_certs = None
keyfile = None
certfile = None
http = False
argi = 1
if sys.argv[argi] == '-h':
    parts = sys.argv[argi + 1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    argi += 2
if sys.argv[argi] == '-u':
    url = urlparse(sys.argv[argi + 1])
    parts = url[1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    else:
        port = 80
    uri = url[2]
    if url[4]:
        uri += '?%s' % url[4]
    http = True
    argi += 2
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
    framed = True
    argi += 1
if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
    ssl = True
    argi += 1
if sys.argv[argi] == '-novalidate':
    validate = False
    argi += 1
if sys.argv[argi] == '-ca_certs':
    ca_certs = sys.argv[argi + 1]
    argi += 2
if sys.argv[argi] == '-keyfile':
    keyfile = sys.argv[argi + 1]
    argi += 2
if sys.argv[argi] == '-certfile':
    certfile = sys.argv[argi + 1]
    argi += 2
cmd = sys.argv[argi]
args = sys.argv[argi + 1:]
if http:
    transport = THttpClient.THttpClient(host, port, uri)
else:
    if ssl:
        socket = TSSLSocket.TSSLSocket(host, port, validate=validate,
            ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
    else:
        socket = TSocket.TSocket(host, port)
    if framed:
        transport = TTransport.TFramedTransport(socket)
    else:
        transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol(transport)
client = ncTEACPLog.Client(protocol)
transport.open()
if cmd == 'Log':
    if len(args) != 1:
        print('Log requires 1 args')
        sys.exit(1)
    pp.pprint(client.Log(eval(args[0])))
elif cmd == 'GetLogCount':
    if len(args) != 1:
        print('GetLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetLogCount(eval(args[0])))
elif cmd == 'GetPageLog':
    if len(args) != 1:
        print('GetPageLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageLog(eval(args[0])))
elif cmd == 'ExportLog':
    if len(args) != 1:
        print('ExportLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.ExportLog(eval(args[0])))
elif cmd == 'SetLogRetentionPeriod':
    if len(args) != 1:
        print('SetLogRetentionPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogRetentionPeriod(eval(args[0])))
elif cmd == 'GetLogRetentionPeriod':
    if len(args) != 0:
        print('GetLogRetentionPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogRetentionPeriod())
elif cmd == 'GetHistoryLogs':
    if len(args) != 1:
        print('GetHistoryLogs requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogs(eval(args[0])))
elif cmd == 'GetHistoryLogCount':
    if len(args) != 1:
        print('GetHistoryLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogCount(eval(args[0])))
elif cmd == 'GetPageHistoryLog':
    if len(args) != 1:
        print('GetPageHistoryLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageHistoryLog(eval(args[0])))
elif cmd == 'GetHistoryLogDownLoadInfo':
    if len(args) != 4:
        print('GetHistoryLogDownLoadInfo requires 4 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogDownLoadInfo(args[0], args[1], eval(args[
        2]), eval(args[3])))
elif cmd == 'ReadHistoryLog':
    if len(args) != 3:
        print('ReadHistoryLog requires 3 args')
        sys.exit(1)
    pp.pprint(client.ReadHistoryLog(args[0], eval(args[1]), eval(args[2])))
elif cmd == 'GetLogSpaceInfo':
    if len(args) != 0:
        print('GetLogSpaceInfo requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogSpaceInfo())
elif cmd == 'GetBufferedLogs':
    if len(args) != 0:
        print('GetBufferedLogs requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetBufferedLogs())
elif cmd == 'SetSyslogFirstPushTime':
    if len(args) != 1:
        print('SetSyslogFirstPushTime requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetSyslogFirstPushTime(eval(args[0])))
elif cmd == 'SetLogPushPeriod':
    if len(args) != 1:
        print('SetLogPushPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogPushPeriod(eval(args[0])))
elif cmd == 'GetLogPushPeriod':
    if len(args) != 0:
        print('GetLogPushPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogPushPeriod())
else:
    print('Unrecognized method %s' % cmd)
    sys.exit(1)
transport.close()

#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.13.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

import sys
import pprint
if sys.version_info[0] > 2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse
from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocol

from EACPLog import ncTEACPLog
from EACPLog.ttypes import *

if len(sys.argv) <= 1 or sys.argv[1] == '--help':
    print('')
    print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]')
    print('')
    print('Functions:')
    print('  void Log(ncTLogItem item)')
    print('  ncTLogCountInfo GetLogCount(ncTGetLogCountParam param)')
    print('   GetPageLog(ncTGetPageLogParam param)')
    print('  string ExportLog(ncTExportLogParam param)')
    print('  void SetLogRetentionPeriod(i32 period)')
    print('  i32 GetLogRetentionPeriod()')
    print('   GetHistoryLogs(ncTLogType logType)')
    print('  i64 GetHistoryLogCount(ncTGetHistoryLogCountParam param)')
    print('   GetPageHistoryLog(ncTGetPageHistoryLogParam param)')
    print('  ncTEVFSOSSRequest GetHistoryLogDownLoadInfo(string id, string reqHost, bool useHttps, i64 validSeconds)')
    print('  string ReadHistoryLog(string fileId, i64 offset, i32 length)')
    print('  ncTLogSpaceInfo GetLogSpaceInfo()')
    print('   GetBufferedLogs()')
    print('  void SetSyslogFirstPushTime(i64 time)')
    print('  void SetLogPushPeriod(i32 period)')
    print('  i32 GetLogPushPeriod()')
    print('')
    sys.exit(0)

pp = pprint.PrettyPrinter(indent=2)
host = 'localhost'
port = 9090
uri = ''
framed = False
ssl = False
validate = True
ca_certs = None
keyfile = None
certfile = None
http = False
argi = 1

if sys.argv[argi] == '-h':
    parts = sys.argv[argi + 1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    argi += 2

if sys.argv[argi] == '-u':
    url = urlparse(sys.argv[argi + 1])
    parts = url[1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    else:
        port = 80
    uri = url[2]
    if url[4]:
        uri += '?%s' % url[4]
    http = True
    argi += 2

if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
    framed = True
    argi += 1

if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
    ssl = True
    argi += 1

if sys.argv[argi] == '-novalidate':
    validate = False
    argi += 1

if sys.argv[argi] == '-ca_certs':
    ca_certs = sys.argv[argi+1]
    argi += 2

if sys.argv[argi] == '-keyfile':
    keyfile = sys.argv[argi+1]
    argi += 2

if sys.argv[argi] == '-certfile':
    certfile = sys.argv[argi+1]
    argi += 2

cmd = sys.argv[argi]
args = sys.argv[argi + 1:]

if http:
    transport = THttpClient.THttpClient(host, port, uri)
else:
    if ssl:
        socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
    else:
        socket = TSocket.TSocket(host, port)
    if framed:
        transport = TTransport.TFramedTransport(socket)
    else:
        transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol(transport)
client = ncTEACPLog.Client(protocol)
transport.open()

if cmd == 'Log':
    if len(args) != 1:
        print('Log requires 1 args')
        sys.exit(1)
    pp.pprint(client.Log(eval(args[0]),))

elif cmd == 'GetLogCount':
    if len(args) != 1:
        print('GetLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetLogCount(eval(args[0]),))

elif cmd == 'GetPageLog':
    if len(args) != 1:
        print('GetPageLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageLog(eval(args[0]),))

elif cmd == 'ExportLog':
    if len(args) != 1:
        print('ExportLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.ExportLog(eval(args[0]),))

elif cmd == 'SetLogRetentionPeriod':
    if len(args) != 1:
        print('SetLogRetentionPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogRetentionPeriod(eval(args[0]),))

elif cmd == 'GetLogRetentionPeriod':
    if len(args) != 0:
        print('GetLogRetentionPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogRetentionPeriod())

elif cmd == 'GetHistoryLogs':
    if len(args) != 1:
        print('GetHistoryLogs requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogs(eval(args[0]),))

elif cmd == 'GetHistoryLogCount':
    if len(args) != 1:
        print('GetHistoryLogCount requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogCount(eval(args[0]),))

elif cmd == 'GetPageHistoryLog':
    if len(args) != 1:
        print('GetPageHistoryLog requires 1 args')
        sys.exit(1)
    pp.pprint(client.GetPageHistoryLog(eval(args[0]),))

elif cmd == 'GetHistoryLogDownLoadInfo':
    if len(args) != 4:
        print('GetHistoryLogDownLoadInfo requires 4 args')
        sys.exit(1)
    pp.pprint(client.GetHistoryLogDownLoadInfo(args[0], args[1], eval(args[2]), eval(args[3]),))

elif cmd == 'ReadHistoryLog':
    if len(args) != 3:
        print('ReadHistoryLog requires 3 args')
        sys.exit(1)
    pp.pprint(client.ReadHistoryLog(args[0], eval(args[1]), eval(args[2]),))

elif cmd == 'GetLogSpaceInfo':
    if len(args) != 0:
        print('GetLogSpaceInfo requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogSpaceInfo())

elif cmd == 'GetBufferedLogs':
    if len(args) != 0:
        print('GetBufferedLogs requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetBufferedLogs())

elif cmd == 'SetSyslogFirstPushTime':
    if len(args) != 1:
        print('SetSyslogFirstPushTime requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetSyslogFirstPushTime(eval(args[0]),))

elif cmd == 'SetLogPushPeriod':
    if len(args) != 1:
        print('SetLogPushPeriod requires 1 args')
        sys.exit(1)
    pp.pprint(client.SetLogPushPeriod(eval(args[0]),))

elif cmd == 'GetLogPushPeriod':
    if len(args) != 0:
        print('GetLogPushPeriod requires 0 args')
        sys.exit(1)
    pp.pprint(client.GetLogPushPeriod())

else:
    print('Unrecognized method %s' % cmd)
    sys.exit(1)

transport.close()
