Skip to content

Commit c87c826

Browse files
committed
fix: res referenced before assignment
Signed-off-by: joseph-sentry <[email protected]>
1 parent 02bf400 commit c87c826

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

codecovopentelem/__init__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,19 @@ def export(self, spans):
121121
if not tracked_spans and not untracked_spans:
122122
return SpanExportResult.SUCCESS
123123
url = urllib.parse.urljoin(self._codecov_endpoint, "/profiling/uploads")
124+
headers = {"Authorization": f"repotoken {self._repository_token}"}
125+
json_data = {"profiling": self._code}
124126
try:
125127
res = requests.post(
126128
url,
127-
headers={"Authorization": f"repotoken {self._repository_token}"},
128-
json={"profiling": self._code},
129+
headers=headers,
130+
json=json_data,
129131
)
130132
res.raise_for_status()
131133
except requests.RequestException:
132134
log.warning(
133135
"Unable to send profiling data to codecov",
134-
extra=dict(response_data=res.json())
136+
extra=dict(url=url, json=json_data)
135137
)
136138
return SpanExportResult.FAILURE
137139
location = res.json()["raw_upload_location"]

0 commit comments

Comments
 (0)