mirror of
https://github.com/bisq-network/bisq-api-reference.git
synced 2026-01-26 17:33:33 +00:00
Parse positional program args in main
This commit is contained in:
parent
83ffc7ba2d
commit
5e631fff0a
@ -1,3 +1,4 @@
|
||||
import argparse
|
||||
import configparser
|
||||
import sys
|
||||
import threading
|
||||
@ -209,5 +210,18 @@ class BestPricedOfferBot(BisqClient):
|
||||
return 'BestPricedOfferBot: ' + 'host=' + self.host + ', port=' + str(self.port) + ', api_password=' + '*****'
|
||||
|
||||
|
||||
def main(host, port, api_password):
|
||||
BestPricedOfferBot(host, port, api_password).run()
|
||||
def parse_args(sysargv):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('host', help='API daemon hostname or IP address')
|
||||
parser.add_argument('port', type=int, help='API daemon listening port')
|
||||
parser.add_argument('api_password', help='API password')
|
||||
return parser.parse_args(sysargv)
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args(sys.argv[1:])
|
||||
BestPricedOfferBot(args.host, args.port, args.api_password).run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user