-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCML2MD_errors.py
More file actions
27 lines (23 loc) · 979 Bytes
/
Copy pathCML2MD_errors.py
File metadata and controls
27 lines (23 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#####################################################################################
#
# Name: CML2MD_errors.py
# Author: Rick R
# Purpose: Error routines to support k-rest.py
#
#####################################################################################
import json
def kPrintError(t_str, t_r):
# -----------------------------------------------------------------------------
# The objective is to print the error information back in the even that a HTTPS
# response is not STATUS_OK
# -----------------------------------------------------------------------------
t_str_sc = str(t_r.status_code)
t_str_r = str(t_r.reason)
# if 'error' in str(t_r.json()):
# t_str_e = str(t_r.json()['error'])
# else:
# t_str_e = str(t_r.json())
t_str_e = t_str
tmpstr = " --> %s Status Code: %s\n Reason: %s\n Error: %s" %(t_str, t_str_sc, t_str_r, t_str_e)
print(tmpstr)
return