Skip to content

Commit

Permalink
Merge branch 'master' into type-minio-init
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 authored Sep 25, 2023
2 parents 41a232d + 1d70730 commit 9db2dc5
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions minio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from io import BytesIO
from random import random
from threading import Thread
from typing import TextIO
from typing import BinaryIO, TextIO
from urllib.parse import urlunsplit
from xml.etree import ElementTree as ET

Expand Down Expand Up @@ -64,7 +64,7 @@
from .retention import Retention
from .select import SelectObjectReader, SelectRequest
from .signer import presign_v4, sign_v4_s3
from .sse import SseCustomerKey
from .sse import Sse, SseCustomerKey
from .sseconfig import SSEConfig
from .tagging import Tagging
from .versioningconfig import VersioningConfig
Expand Down Expand Up @@ -1090,9 +1090,17 @@ def fget_object(self, bucket_name, object_name, file_path,
response.close()
response.release_conn()

def get_object(self, bucket_name, object_name, offset=0, length=0,
request_headers=None, ssec=None, version_id=None,
extra_query_params=None):
def get_object(
self,
bucket_name: str,
object_name: str,
offset: int = 0,
length: int = 0,
request_headers: dict[str, str] | None = None,
ssec: SseCustomerKey | None = None,
version_id: str | None = None,
extra_query_params: dict[str, str] | None = None
) -> urllib3.BaseHTTPResponse:
"""
Get data of an object. Returned response should be closed after use to
release network resources. To reuse the connection, it's required to
Expand Down Expand Up @@ -1617,11 +1625,22 @@ def _upload_part_task(self, args):
"""Upload_part task for ThreadPool."""
return args[5], self._upload_part(*args)

def put_object(self, bucket_name, object_name, data, length,
content_type="application/octet-stream",
metadata=None, sse=None, progress=None,
part_size=0, num_parallel_uploads=3,
tags=None, retention=None, legal_hold=False):
def put_object(
self,
bucket_name: str,
object_name: str,
data: BinaryIO,
length: int,
content_type: str = "application/octet-stream",
metadata: dict[str, str] | None = None,
sse: Sse | None = None,
progress: Thread | None = None,
part_size: int = 0,
num_parallel_uploads: int = 3,
tags: Tags | None = None,
retention: Retention | None = None,
legal_hold: bool = False
) -> ObjectWriteResult:
"""
Uploads data from a stream to an object in a bucket.
Expand Down

0 comments on commit 9db2dc5

Please sign in to comment.