From 6cce800d18b14fd07340d6c2bea03c9de9d992fb Mon Sep 17 00:00:00 2001 From: Yodster Date: Tue, 6 Dec 2022 14:02:00 -0500 Subject: [PATCH 1/2] Adding UK region support to cbn-tool --- cbn_cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cbn_cli.py b/cbn_cli.py index bb44d08..7e2d403 100755 --- a/cbn_cli.py +++ b/cbn_cli.py @@ -40,6 +40,7 @@ # URLs for Chronicle CBN API endpoints. CHRONICLE_API_V1_URL = 'https://backstory.googleapis.com/v1' CHRONICLE_API_EUROPE_V1_URL = 'https://europe-backstory.googleapis.com/v1' +CHRONICLE_API_UK_V1_URL = 'https://europe-west2-backstory.googleapis.com/v1' CHRONICLE_API_ASIA_URL = 'https://asia-southeast1-backstory.googleapis.com/v1' # HTTP Request related constants. @@ -54,6 +55,8 @@ def get_connecting_url(args): url = CHRONICLE_API_EUROPE_V1_URL elif args.region == 'ASIA': url = CHRONICLE_API_ASIA_URL + elif args.region == 'UK': + url = CHRONICLE_API_UK_V1_URL return url @@ -427,7 +430,7 @@ def arg_parser(): '--region', type=str, default='US', - choices=['US', 'EUROPE', 'ASIA'], + choices=['US', 'EUROPE', 'ASIA', 'UK'], help="""Optionally specify the region for API calls""") parser.add_argument( From 136d8af5d142c625c3b1fe77786c3b45d139293b Mon Sep 17 00:00:00 2001 From: Yodster Date: Tue, 6 Dec 2022 14:04:02 -0500 Subject: [PATCH 2/2] Adding UK region to test file. --- cbn_cli_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cbn_cli_test.py b/cbn_cli_test.py index 6f59d96..faa4941 100644 --- a/cbn_cli_test.py +++ b/cbn_cli_test.py @@ -57,6 +57,7 @@ def tearDown(self): ('', cbn_cli.CHRONICLE_API_V1_URL), ('EUROPE', cbn_cli.CHRONICLE_API_EUROPE_V1_URL), ('ASIA', cbn_cli.CHRONICLE_API_ASIA_URL), + ('UK', cbn_cli.CHRONICLE_API_UK_V1_URL), ]) def test_get_connecting_url(self, region, expected_url): args = cbn_cli.arg_parser().parse_args()