Skip to content

Commit 3258522

Browse files
committed
handle ssl cert failure in source api
1 parent 51701b6 commit 3258522

File tree

3 files changed

+14
-39
lines changed

3 files changed

+14
-39
lines changed

sliderule/sliderule.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ def source (api, parm={}, stream=False, callbacks={}):
425425
raise TypeError('unsupported content type: %s' % (format))
426426
# Complete
427427
break
428+
except requests.exceptions.SSLError as e:
429+
logger.error("Unable to verify SSL certificate: {}".format(e))
428430
except requests.ConnectionError as e:
429431
logger.error("Failed to connect to endpoint {} ... retrying request".format(url))
430432
except requests.Timeout as e:

utils/query_services.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

utils/query_version.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
import sys
22
import json
3+
import logging
34
import sliderule
45
from sliderule import icesat2
6+
from utils import parse_command_line
57

68
###############################################################################
79
# MAIN
810
###############################################################################
911

1012
if __name__ == '__main__':
1113

12-
url = "127.0.0.1"
13-
organization=None
14+
# Set Script Defaults
15+
cfg = {
16+
"url": 'localhost',
17+
"organization": None,
18+
}
1419

15-
# Server URL
16-
if len(sys.argv) > 1:
17-
url = sys.argv[1]
20+
# Parse Configuration Parameters
21+
parse_command_line(sys.argv, cfg)
1822

19-
# Organization
20-
if len(sys.argv) > 2:
21-
organization = sys.argv[2]
23+
# Configure Logging
24+
logging.basicConfig(level=logging.INFO)
2225

2326
# Initialize ICESat2/SlideRule Package
24-
icesat2.init(url, organization=organization)
27+
icesat2.init(cfg["url"], organization=cfg["organization"])
2528

2629
# Query Version
2730
rsps = sliderule.source("version", {})

0 commit comments

Comments
 (0)