mirror of https://gitlab.com/bashrc2/epicyon
Use a copy of the session headers for debug output
parent
1c31d54636
commit
51d59f3706
19
session.py
19
session.py
|
@ -102,12 +102,13 @@ def _get_json_request(session, url: str, domain_full: str, session_headers: {},
|
||||||
elif result.status_code == 410:
|
elif result.status_code == 410:
|
||||||
print('WARN: get_json no longer available url: ' + url)
|
print('WARN: get_json no longer available url: ' + url)
|
||||||
else:
|
else:
|
||||||
if session_headers.get('Authorization'):
|
session_headers2 = session_headers.copy()
|
||||||
session_headers['Authorization'] = 'REDACTED'
|
if session_headers2.get('Authorization'):
|
||||||
|
session_headers2['Authorization'] = 'REDACTED'
|
||||||
print('WARN: get_json url: ' + url +
|
print('WARN: get_json url: ' + url +
|
||||||
' failed with error code ' +
|
' failed with error code ' +
|
||||||
str(result.status_code) +
|
str(result.status_code) +
|
||||||
' headers: ' + str(session_headers))
|
' headers: ' + str(session_headers2))
|
||||||
if return_json:
|
if return_json:
|
||||||
return result.json()
|
return result.json()
|
||||||
return result.content
|
return result.content
|
||||||
|
@ -294,10 +295,13 @@ def get_vcard(xml_format: bool,
|
||||||
elif result.status_code == 410:
|
elif result.status_code == 410:
|
||||||
print('WARN: get_vcard no longer available url: ' + url)
|
print('WARN: get_vcard no longer available url: ' + url)
|
||||||
else:
|
else:
|
||||||
|
session_headers2 = session_headers.copy()
|
||||||
|
if session_headers2.get('Authorization'):
|
||||||
|
session_headers2['Authorization'] = 'REDACTED'
|
||||||
print('WARN: get_vcard url: ' + url +
|
print('WARN: get_vcard url: ' + url +
|
||||||
' failed with error code ' +
|
' failed with error code ' +
|
||||||
str(result.status_code) +
|
str(result.status_code) +
|
||||||
' headers: ' + str(session_headers))
|
' headers: ' + str(session_headers2))
|
||||||
return result.content.decode('utf-8')
|
return result.content.decode('utf-8')
|
||||||
except requests.exceptions.RequestException as ex:
|
except requests.exceptions.RequestException as ex:
|
||||||
session_headers2 = session_headers.copy()
|
session_headers2 = session_headers.copy()
|
||||||
|
@ -718,12 +722,13 @@ def get_method(method_name: str, xml_str: str,
|
||||||
elif result.status_code == 410:
|
elif result.status_code == 410:
|
||||||
print('WARN: get_method no longer available url: ' + url)
|
print('WARN: get_method no longer available url: ' + url)
|
||||||
else:
|
else:
|
||||||
if session_headers.get('Authorization'):
|
session_headers2 = session_headers.copy()
|
||||||
session_headers['Authorization'] = 'REDACTED'
|
if session_headers2.get('Authorization'):
|
||||||
|
session_headers2['Authorization'] = 'REDACTED'
|
||||||
print('WARN: get_method url: ' + url +
|
print('WARN: get_method url: ' + url +
|
||||||
' failed with error code ' +
|
' failed with error code ' +
|
||||||
str(result.status_code) +
|
str(result.status_code) +
|
||||||
' headers: ' + str(session_headers))
|
' headers: ' + str(session_headers2))
|
||||||
return result.content.decode('utf-8')
|
return result.content.decode('utf-8')
|
||||||
except requests.exceptions.RequestException as ex:
|
except requests.exceptions.RequestException as ex:
|
||||||
session_headers2 = session_headers.copy()
|
session_headers2 = session_headers.copy()
|
||||||
|
|
Loading…
Reference in New Issue