37 lines
1009 B
Python
37 lines
1009 B
Python
from optparse import OptionParser
|
|
|
|
from tornado import gen
|
|
from tornado import httpclient
|
|
from tornado import httputil
|
|
from tornado import ioloop
|
|
from tornado import websocket
|
|
|
|
import virtualclient
|
|
|
|
@gen.coroutine
|
|
def createVirtualClient(account, ws_url):
|
|
virtualclient.VirtualClient(ws_url, account).run()
|
|
|
|
@gen.coroutine
|
|
def main():
|
|
parser = OptionParser(usage="%prog [options]")
|
|
parser.add_option("-a",
|
|
"--accounts",
|
|
dest = "accounts",
|
|
help = "account info")
|
|
(options, args) = parser.parse_args()
|
|
|
|
ws_url = args if args else 'ws://192.168.100.21:7101/websocket'
|
|
accounts = options.accounts.split(',')
|
|
accounts = []
|
|
for i in range(500):
|
|
accounts.append('test' + str(i))
|
|
for account in accounts:
|
|
ioloop.IOLoop.current().spawn_callback(createVirtualClient, account, ws_url)
|
|
|
|
while True:
|
|
yield gen.sleep(0.1)
|
|
|
|
if __name__ == '__main__':
|
|
ioloop.IOLoop.current().run_sync(main)
|