Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunandadadi committed Oct 29, 2024
1 parent 65e84e7 commit 78f6327
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions storage/akamaistorage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging
import urllib.parse
from akamai.edgeauth import EdgeAuth, EdgeAuthError

# ignoring the below type check as mypy fails with "missing library stubs or py.typed marker" error
from akamai.edgeauth import EdgeAuth, EdgeAuthError # type: ignore

logger = logging.getLogger(__name__)

Expand All @@ -16,15 +18,15 @@ class AkamaiS3Storage(S3Storage):
"""

def __init__(
self,
context,
akamai_domain,
akamai_shared_secret,
storage_path,
s3_bucket,
s3_region,
*args,
**kwargs,
self,
context,
akamai_domain,
akamai_shared_secret,
storage_path,
s3_bucket,
s3_region,
*args,
**kwargs,
):
super(AkamaiS3Storage, self).__init__(
context, storage_path, s3_bucket, s3_region=s3_region, *args, **kwargs
Expand All @@ -41,7 +43,7 @@ def __init__(
)

def get_direct_download_url(
self, path, request_ip=None, expires_in=60, requires_cors=False, head=False, **kwargs
self, path, request_ip=None, expires_in=60, requires_cors=False, head=False, **kwargs
):
# If CloudFront could not be loaded, fall back to normal S3.
s3_presigned_url = super(AkamaiS3Storage, self).get_direct_download_url(
Expand Down Expand Up @@ -73,7 +75,6 @@ def get_direct_download_url(
query=f"{akamai_url_parsed.query}&{TOKEN_QUERY_STRING}={self.et.generate_url_token(to_sign)}"
)


except EdgeAuthError as e:
logger.error(f"Failed to generate Akamai token: {e}")
return s3_presigned_url
Expand Down

0 comments on commit 78f6327

Please sign in to comment.