Commit Graph

7 Commits

Author SHA1 Message Date
Harald Welte 7ae4b6d61f cbc-apitool: Make character set configurable
osmo-cbc already supported the transmission of UCS2 characters for quite
some time.  However, the cbc-apitool didn't expose this capability so
far.

Change-Id: Ia7291238f3b0af8ff9f476fce9a7805e12821d8c
Related: OS#6028
2023-10-19 07:20:35 +00:00
Pau Espin 028b48b967 cbc-apitool: print usage instead of crashing if no subcmd passed
The "required" param was added in python 3.7.

Change-Id: Ia8d13beeb8da64644d1aaf36deeddda4de889a6c
2022-07-25 14:27:48 +02:00
Pau Espin 01338add1d cbc-apitool: Fix port stored in var as a string
Passing "-p 12345" on the cmd line, fixes:
"""
  File "/osmo-cbc/contrib/./cbc-apitool.py", line 20, in build_url
    return "http://%s:%u%s%s" % (server_host, server_port, BASE_PATH, suffix)
TypeError: %u format: a real number is required, not str
"""

Change-Id: Ief688bb8c2a6cfa410608a6896ce3cb5df4eb48e
2022-07-22 17:58:33 +02:00
Harald Welte d6a3728bce cbc-apitool: compatibility with python < 3.7
The "required" parameter to argparse.add_subparsers() was only
added in python 3.7.  However, given that it defaults to 'required'
and was always unconditionally required even in python 2.x,
we can safely remove it.

Change-Id: Ia0ffca055f47016fb29ef009acecac2a139e4077
2021-02-16 22:12:10 +01:00
Harald Welte 367cdb3697 cbc-apitool: Fix parsing if no argument is goven
Change-Id: I3abd7a22dc5df2bf7c926fb0e1ba09e60628f55d
2021-01-24 14:05:47 +01:00
Harald Welte 8b596fecb1 cbc-apitool.py: Generalize, make parameters configurable
Do away with most of the hard-coded defaults and allow user to specify
a variety of parameters via the command line.  Also, start to use
argparse subparsers for better usability

Change-Id: Ib7b8121676bef9310f219affc6f3cc76b6986b2a
2021-01-23 23:48:04 +01:00
Harald Welte 5bf735efc9 Add simplistic cbc-apitool.py as example on how to use the REST API
Change-Id: I6cbc30a3f8bf833fea785437488aed8b8af2fcbc
2021-01-22 20:15:30 +01:00