Skip to content

Provide a way to set the S3 signature version when signing requests #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions xocto/storage/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import magic
import pandas as pd
from botocore import exceptions as botocore_exceptions
from botocore.config import Config
from botocore.response import StreamingBody
from django.conf import settings
from django.urls import reverse
Expand Down Expand Up @@ -808,10 +809,19 @@ def _get_policy(self) -> str | None:
return None

def _get_boto_client(self) -> S3Client:
client_kwargs = {}
if (
hasattr(settings, "AWS_S3_ENDPOINT_URL")
and settings.AWS_S3_SIGNATURE_VERSION is not None
):
client_kwargs["config"] = Config(
signature_version=settings.AWS_S3_SIGNATURE_VERSION
)
return boto3.client(
"s3",
region_name=settings.AWS_REGION,
endpoint_url=settings.AWS_S3_ENDPOINT_URL,
**client_kwargs,
)

def _get_boto_bucket(self) -> service_resource.Bucket:
Expand Down