Skip to content

Commit

Permalink
Fix type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Huang authored and Nick Huang committed Oct 9, 2024
1 parent f3d6aa2 commit b6fd11b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,12 +936,12 @@ def request_with_retries(
debug_crash_dump_file = ls_utils.get_env_var(
"LANGSMITH_DEBUG_CRASH_DUMP"
)
if debug_crash_dump_file is not None:
request_data: (
requests.Request | requests.PreparedRequest | dict
) = (copy.deepcopy(e.request) if e.request else {})
if "x-api-key" in request_data.get("headers", {}):
request_data["headers"]["x-api-key"] = masked_api_key
if debug_crash_dump_file is not None and e.request is not None:
request_data: requests.Request | requests.PreparedRequest = (
copy.deepcopy(e.request)
)
if "x-api-key" in request_data.headers:
request_data.headers["x-api-key"] = masked_api_key
with gzip.open(debug_crash_dump_file, "ab") as f:
json_data = json.dumps(request_data).encode("utf-8")
f.write(json_data + b"\n")
Expand Down

0 comments on commit b6fd11b

Please sign in to comment.