mirror of
https://github.com/bisq-network/bisq-api-reference.git
synced 2026-05-20 12:24:14 +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 configparser
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
@ -209,5 +210,18 @@ class BestPricedOfferBot(BisqClient):
|
|||||||
return 'BestPricedOfferBot: ' + 'host=' + self.host + ', port=' + str(self.port) + ', api_password=' + '*****'
|
return 'BestPricedOfferBot: ' + 'host=' + self.host + ', port=' + str(self.port) + ', api_password=' + '*****'
|
||||||
|
|
||||||
|
|
||||||
def main(host, port, api_password):
|
def parse_args(sysargv):
|
||||||
BestPricedOfferBot(host, port, api_password).run()
|
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