Locust. Read --host value from python code -


locust --no-web --client=1 --hatch-rate=1 --num-request=2 --host= http://localhost

i want read --host value provided in cmd line in httplocust class. aware can use host attribute direct assignment not want it. want read value cmd line in httplocust class. building custom logs , want pass value logs. tried httplocust.host returns none.

also want read --web-port python code.

you can access via sys.argv

or parse options via argparse

import argparse  parser = argparse.argumentparser() parser.add_argument('-h', '--host') args, unknown = parser.parse_known_args()  print str(args.host) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -