Skip to content

Commit

Permalink
Fix formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
wantsui committed Jan 2, 2025
1 parent bf2776b commit 9f12157
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
20 changes: 15 additions & 5 deletions ddtrace/profiling/exporter/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def __init__(
self.version: typing.Optional[str] = version
self.tags: typing.Dict[str, str] = tags if tags is not None else {}
self.max_retry_delay: typing.Optional[float] = max_retry_delay
self.endpoint_call_counter_span_processor: typing.Optional[
EndpointCallCounterProcessor
] = endpoint_call_counter_span_processor
self.endpoint_call_counter_span_processor: typing.Optional[EndpointCallCounterProcessor] = (
endpoint_call_counter_span_processor
)

self.__post_init__()

Expand Down Expand Up @@ -220,8 +220,18 @@ def export(
"family": "python",
"attachments": [item["filename"].decode("utf-8") for item in data],
"tags_profiler": self._get_tags(service),
"start": (datetime.datetime.fromtimestamp(start_time_ns / 1e9, tz=datetime.timezone.utc).replace(microsecond=0).isoformat() + "Z"),
"end": (datetime.datetime.fromtimestamp(end_time_ns / 1e9, tz=datetime.timezone.utc).replace(microsecond=0).isoformat() + "Z"),
"start": (
datetime.datetime.fromtimestamp(start_time_ns / 1e9, tz=datetime.timezone.utc)
.replace(microsecond=0)
.isoformat()
+ "Z"
),
"end": (
datetime.datetime.fromtimestamp(end_time_ns / 1e9, tz=datetime.timezone.utc)
.replace(microsecond=0)
.isoformat()
+ "Z"
),
} # type: Dict[str, Any]

if self.endpoint_call_counter_span_processor is not None:
Expand Down
6 changes: 5 additions & 1 deletion tests/appsec/iast_packages/packages/pkg_pyjwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
https://pypi.org/project/PyJWT/
"""

import datetime

from flask import Blueprint
Expand All @@ -25,7 +26,10 @@ def pkg_pyjwt_view():
secret_key = "your-256-bit-secret"
user_payload = request.args.get("package_param", "default-user")

payload = {"user": user_payload, "exp": datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(seconds=30)}
payload = {
"user": user_payload,
"exp": datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(seconds=30),
}

try:
# Encode the payload to create a JWT
Expand Down

0 comments on commit 9f12157

Please sign in to comment.