Skip to content

Commit

Permalink
SDK-375: Added support for Qubole-trace-Id (#285)
Browse files Browse the repository at this point in the history
Added support for Qubole-trace-Id
  • Loading branch information
shekharsaurabh authored and chattarajoy committed Oct 11, 2019
1 parent c780a56 commit 5eb54be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion qds_sdk/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import pkg_resources
from requests.adapters import HTTPAdapter
from datetime import datetime
try:
from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
Expand Down Expand Up @@ -130,7 +131,13 @@ def _handle_error(response):

if 200 <= code < 400:
return


if 'X-Qubole-Trace-Id' in response.headers:
now = datetime.now()
time = now.strftime('%Y-%m-%d %H:%M:%S')
format_list = [time,response.headers['X-Qubole-Trace-Id']]
sys.stderr.write("[{}] Request ID is: {}. Please share it with Qubole Support team for any assistance".format(*format_list) + "\n")

if code == 400:
sys.stderr.write(response.text + "\n")
raise BadRequest(response)
Expand Down

0 comments on commit 5eb54be

Please sign in to comment.