Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3acf72

Browse files
committed
Fix for argparse issue
1 parent 2356318 commit a3acf72

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

lib/utils/restapi.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
See the file 'doc/COPYING' for copying permission
66
"""
77

8-
import argparse
8+
import optparse
99
import os
1010
import sys
1111

@@ -184,12 +184,12 @@ def client(host, port):
184184
Standalone REST-JSON API wrapper function
185185
"""
186186

187-
parser = argparse.ArgumentParser()
188-
parser.add_argument("-s", "--server", help="Act as a REST-JSON API server", default=RESTAPI_SERVER_PORT, action="store_true", required=False)
189-
parser.add_argument("-c", "--client", help="Act as a REST-JSON API client", default=RESTAPI_SERVER_PORT, action="store_true", required=False)
190-
parser.add_argument("-H", "--host", help="Host of the REST-JSON API server", default="0.0.0.0", action="store", required=False)
191-
parser.add_argument("-p", "--port", help="Port of the the REST-JSON API server", default=RESTAPI_SERVER_PORT, action="store", required=False)
192-
args = parser.parse_args()
187+
parser = optparse.OptionParser()
188+
parser.add_option("-s", "--server", help="Act as a REST-JSON API server", default=RESTAPI_SERVER_PORT, action="store_true")
189+
parser.add_option("-c", "--client", help="Act as a REST-JSON API client", default=RESTAPI_SERVER_PORT, action="store_true")
190+
parser.add_option("-H", "--host", help="Host of the REST-JSON API server", default="0.0.0.0", action="store")
191+
parser.add_option("-p", "--port", help="Port of the the REST-JSON API server", default=RESTAPI_SERVER_PORT, action="store")
192+
(args, _) = parser.parse_args()
193193

194194
if args.server is True:
195195
restAPIrun(args.host, args.port)

0 commit comments

Comments
 (0)