Skip to content

Commit

Permalink
🎨 Format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Feb 8, 2024
1 parent d304e0b commit 97ff931
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
15 changes: 9 additions & 6 deletions log_outgoing_requests/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,21 @@ def emit(self, record: AnyLogRecord):
"url": request.url if request else "(unknown)",
"hostname": parsed_url.netloc if parsed_url else "(unknown)",
"params": parsed_url.params if parsed_url else "(unknown)",
"status_code": response.status_code if response is not None else None,
"status_code": response.status_code if response is not None else None,
"method": request.method if request else "(unknown)",
"timestamp": timestamp,
"response_ms": int(response.elapsed.total_seconds() * 1000)
if response is not None
else 0,
"response_ms": (
int(response.elapsed.total_seconds() * 1000)
if response is not None
else 0
),
"req_headers": self.format_headers(scrubbed_req_headers),
"res_headers": self.format_headers(response.headers if response is not None else {}),
"res_headers": self.format_headers(
response.headers if response is not None else {}
),
"trace": "\n".join(format_exception(exception)) if exception else "",
}


if config.save_body_enabled:
# check request
if (
Expand Down
12 changes: 6 additions & 6 deletions log_outgoing_requests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def check_content_type(content_type: str) -> bool:
For patterns containing a wildcard ("text/*"), check if `content_type.pattern`
is a substring of any pattern contained in the list.
"""
allowed_content_types: Iterable[
ContentType
] = settings.LOG_OUTGOING_REQUESTS_CONTENT_TYPES
allowed_content_types: Iterable[ContentType] = (
settings.LOG_OUTGOING_REQUESTS_CONTENT_TYPES
)
regular_patterns = [
item.pattern for item in allowed_content_types if not item.pattern.endswith("*")
]
Expand All @@ -133,9 +133,9 @@ def get_default_encoding(content_type_pattern: str) -> str:
"""
Get the default encoding for the `ContentType` with the associated pattern.
"""
allowed_content_types: Iterable[
ContentType
] = settings.LOG_OUTGOING_REQUESTS_CONTENT_TYPES
allowed_content_types: Iterable[ContentType] = (
settings.LOG_OUTGOING_REQUESTS_CONTENT_TYPES
)

regular_types = [
item for item in allowed_content_types if not item.pattern.endswith("*")
Expand Down

0 comments on commit 97ff931

Please sign in to comment.