Skip to content

Commit c0843f1

Browse files
committed
Update access_token parameter to allow None and conditionally set Authorization header in payload
1 parent 0219381 commit c0843f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/violation_sender.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ async def send_violation(
181181

182182
def _build_upload_payload(
183183
self,
184-
access_token: str,
184+
access_token: str | None,
185185
image_bytes: bytes,
186186
site: str,
187187
stream_name: str,
@@ -218,9 +218,9 @@ def _build_upload_payload(
218218
str,
219219
]: The headers, files, form data, and upload URL.
220220
"""
221-
headers: dict[str, str] = {
222-
'Authorization': f"Bearer {access_token}",
223-
}
221+
headers: dict[str, str] = {}
222+
if access_token:
223+
headers['Authorization'] = f"Bearer {access_token}"
224224
files: dict[str, tuple[str, bytes, str]] = {
225225
'image': ('violation.jpg', image_bytes, 'image/jpeg'),
226226
}

0 commit comments

Comments
 (0)