miniopy-async 1.18__tar.gz → 1.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {miniopy-async-1.18 → miniopy_async-1.20}/PKG-INFO +1 -1
  2. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/__init__.py +1 -1
  3. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/api.py +29 -16
  4. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/datatypes.py +73 -3
  5. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async.egg-info/PKG-INFO +1 -1
  6. {miniopy-async-1.18 → miniopy_async-1.20}/LICENSE +0 -0
  7. {miniopy-async-1.18 → miniopy_async-1.20}/README.md +0 -0
  8. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/commonconfig.py +0 -0
  9. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/credentials/__init__.py +0 -0
  10. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/credentials/credentials.py +0 -0
  11. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/credentials/providers.py +0 -0
  12. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/deleteobjects.py +0 -0
  13. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/error.py +0 -0
  14. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/helpers.py +0 -0
  15. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/legalhold.py +0 -0
  16. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/lifecycleconfig.py +0 -0
  17. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/minioadmin.py +0 -0
  18. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/notificationconfig.py +0 -0
  19. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/objectlockconfig.py +0 -0
  20. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/progress.py +0 -0
  21. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/replicationconfig.py +0 -0
  22. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/retention.py +0 -0
  23. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/select.py +0 -0
  24. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/signer.py +0 -0
  25. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/sse.py +0 -0
  26. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/sseconfig.py +0 -0
  27. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/tagging.py +0 -0
  28. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/time.py +0 -0
  29. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/versioningconfig.py +0 -0
  30. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async/xml.py +0 -0
  31. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async.egg-info/SOURCES.txt +0 -0
  32. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async.egg-info/dependency_links.txt +0 -0
  33. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async.egg-info/requires.txt +0 -0
  34. {miniopy-async-1.18 → miniopy_async-1.20}/miniopy_async.egg-info/top_level.txt +0 -0
  35. {miniopy-async-1.18 → miniopy_async-1.20}/setup.cfg +0 -0
  36. {miniopy-async-1.18 → miniopy_async-1.20}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: miniopy-async
3
- Version: 1.18
3
+ Version: 1.20
4
4
  Summary: Asynchronous MinIO Client SDK for Python
5
5
  Home-page: https://github.com/hlf20010508/miniopy-async
6
6
  Author: L-ING
@@ -45,7 +45,7 @@ miniopy-async - Asynchronous MinIO Client SDK for Python
45
45
 
46
46
  __title__ = "miniopy-async"
47
47
  __author__ = "L-ING."
48
- __version__ = "1.18"
48
+ __version__ = "1.20"
49
49
  __license__ = "Apache 2.0"
50
50
  __copyright__ = "(C) 2022 L-ING <hlf01@icloud.com>"
51
51
 
@@ -60,6 +60,7 @@ from .datatypes import (
60
60
  PostPolicy,
61
61
  parse_copy_object,
62
62
  parse_list_objects,
63
+ ListObjects,
63
64
  )
64
65
  from .deleteobjects import DeleteError, DeleteRequest, DeleteResult
65
66
  from .error import InvalidResponseError, S3Error, ServerError
@@ -119,6 +120,7 @@ class Minio: # pylint: disable=too-many-public-methods
119
120
  :param region: Region name of buckets in S3 service.
120
121
  :param http_client: Customized HTTP client.
121
122
  :param credentials: Credentials provider of your account in S3 service.
123
+ :param cert_check: Flag to indicate to verify SSL certificate or not.
122
124
  :return: :class:`Minio <Minio>` object
123
125
 
124
126
  Example::
@@ -154,6 +156,7 @@ class Minio: # pylint: disable=too-many-public-methods
154
156
  secure=True,
155
157
  region=None,
156
158
  credentials=None,
159
+ cert_check=True,
157
160
  ):
158
161
  self._region_map = dict()
159
162
  self._base_url = BaseURL(
@@ -164,6 +167,7 @@ class Minio: # pylint: disable=too-many-public-methods
164
167
  if access_key:
165
168
  credentials = StaticProvider(access_key, secret_key, session_token)
166
169
  self._provider = credentials
170
+ self._ssl = None if cert_check else False
167
171
 
168
172
  def _handle_redirect_response(self, method, bucket_name, response, retry=False):
169
173
  """
@@ -261,7 +265,7 @@ class Minio: # pylint: disable=too-many-public-methods
261
265
  session = aiohttp.ClientSession()
262
266
 
263
267
  response = await session.request(
264
- method, urlunsplit(url), data=body, headers=headers
268
+ method, urlunsplit(url), data=body, headers=headers, ssl=self._ssl
265
269
  )
266
270
 
267
271
  if response.status in [200, 204, 206]:
@@ -310,18 +314,22 @@ class Minio: # pylint: disable=too-many-public-methods
310
314
  404: lambda: (
311
315
  ("NoSuchKey", "Object does not exist")
312
316
  if object_name
313
- else ("NoSuchBucket", "Bucket does not exist")
314
- if bucket_name
315
- else ("ResourceNotFound", "Request resource not found")
317
+ else (
318
+ ("NoSuchBucket", "Bucket does not exist")
319
+ if bucket_name
320
+ else ("ResourceNotFound", "Request resource not found")
321
+ )
316
322
  ),
317
323
  405: lambda: (
318
324
  "MethodNotAllowed",
319
325
  "The specified method is not allowed against this resource",
320
326
  ),
321
327
  409: lambda: (
322
- ("NoSuchBucket", "Bucket does not exist")
323
- if bucket_name
324
- else ("ResourceConflict", "Request resource conflicts"),
328
+ (
329
+ ("NoSuchBucket", "Bucket does not exist")
330
+ if bucket_name
331
+ else ("ResourceConflict", "Request resource conflicts")
332
+ ),
325
333
  ),
326
334
  501: lambda: (
327
335
  "MethodNotAllowed",
@@ -2407,7 +2415,7 @@ class Minio: # pylint: disable=too-many-public-methods
2407
2415
  )
2408
2416
  raise exc
2409
2417
 
2410
- async def list_objects(
2418
+ def list_objects(
2411
2419
  self,
2412
2420
  bucket_name,
2413
2421
  prefix=None,
@@ -2452,6 +2460,9 @@ class Minio: # pylint: disable=too-many-public-methods
2452
2460
  for obj in objects:
2453
2461
  print('obj:',obj)
2454
2462
 
2463
+ async for obj in client.list_objects("my-bucket"):
2464
+ print('obj:',obj)
2465
+
2455
2466
  # List objects information whose names starts with "my/prefix/".
2456
2467
  print('example two')
2457
2468
  objects = await client.list_objects("my-bucket",
@@ -2488,15 +2499,16 @@ class Minio: # pylint: disable=too-many-public-methods
2488
2499
  loop.run_until_complete(main())
2489
2500
  loop.close()
2490
2501
  """
2491
- return await self._list_objects(
2492
- bucket_name,
2493
- delimiter=None if recursive else "/",
2494
- include_user_meta=include_user_meta,
2502
+ return ListObjects(
2503
+ client=self,
2504
+ bucket_name=bucket_name,
2495
2505
  prefix=prefix,
2506
+ recursive=recursive,
2496
2507
  start_after=start_after,
2497
- use_api_v1=use_api_v1,
2508
+ include_user_meta=include_user_meta,
2498
2509
  include_version=include_version,
2499
- encoding_type="url" if use_url_encoding_type else None,
2510
+ use_api_v1=use_api_v1,
2511
+ use_url_encoding_type=use_url_encoding_type,
2500
2512
  )
2501
2513
 
2502
2514
  async def stat_object(
@@ -4166,6 +4178,7 @@ class Minio: # pylint: disable=too-many-public-methods
4166
4178
  include_version = True
4167
4179
 
4168
4180
  is_truncated = True
4181
+
4169
4182
  while is_truncated:
4170
4183
  query = {}
4171
4184
  if include_version:
@@ -4207,13 +4220,13 @@ class Minio: # pylint: disable=too-many-public-methods
4207
4220
  version_id_marker,
4208
4221
  ) = await parse_list_objects(response)
4209
4222
 
4223
+ yield objects
4224
+
4210
4225
  if not include_version:
4211
4226
  version_id_marker = None
4212
4227
  if not use_api_v1:
4213
4228
  continuation_token = start_after
4214
4229
 
4215
- return objects
4216
-
4217
4230
  async def _list_multipart_uploads(
4218
4231
  self,
4219
4232
  bucket_name,
@@ -276,9 +276,11 @@ async def parse_list_objects(response, bucket_name=None):
276
276
  objects += [
277
277
  Object(
278
278
  bucket_name,
279
- unquote_plus(findtext(tag, "Prefix", True))
280
- if encoding_type == "url"
281
- else findtext(tag, "Prefix", True),
279
+ (
280
+ unquote_plus(findtext(tag, "Prefix", True))
281
+ if encoding_type == "url"
282
+ else findtext(tag, "Prefix", True)
283
+ ),
282
284
  )
283
285
  for tag in elements
284
286
  ]
@@ -849,3 +851,71 @@ class AsyncEventIterable:
849
851
 
850
852
  async def __aexit__(self, exc_type, value, traceback):
851
853
  self._response.close()
854
+
855
+
856
+ class ListObjects:
857
+ def __init__(
858
+ self,
859
+ client,
860
+ bucket_name,
861
+ prefix=None,
862
+ recursive=False,
863
+ start_after=None,
864
+ include_user_meta=False,
865
+ include_version=False,
866
+ use_api_v1=False,
867
+ use_url_encoding_type=True,
868
+ ):
869
+ self.client = client
870
+ self.bucket_name = bucket_name
871
+ self.prefix = prefix
872
+ self.recursive = recursive
873
+ self.start_after = start_after
874
+ self.include_user_meta = include_user_meta
875
+ self.include_version = include_version
876
+ self.use_api_v1 = use_api_v1
877
+ self.use_url_encoding_type = use_url_encoding_type
878
+ self.objects = []
879
+ self.buffer = []
880
+ self.iterator = None
881
+ self.is_awaited = False
882
+
883
+ def gen_iterator(self):
884
+ return self.client._list_objects(
885
+ self.bucket_name,
886
+ delimiter=None if self.recursive else "/",
887
+ include_user_meta=self.include_user_meta,
888
+ prefix=self.prefix,
889
+ start_after=self.start_after,
890
+ use_api_v1=self.use_api_v1,
891
+ include_version=self.include_version,
892
+ encoding_type="url" if self.use_url_encoding_type else None,
893
+ )
894
+
895
+ def __aiter__(self):
896
+ self.iterator = self.gen_iterator()
897
+ return self
898
+
899
+ async def __anext__(self):
900
+ if self.iterator is None:
901
+ self.gen_iterator()
902
+
903
+ if not self.buffer:
904
+ try:
905
+ self.buffer = await self.iterator.__anext__()
906
+ self.objects.extend(self.buffer)
907
+ except StopAsyncIteration:
908
+ raise StopAsyncIteration
909
+
910
+ return self.buffer.pop(0)
911
+
912
+ def __await__(self):
913
+ return self._collect_objects().__await__()
914
+
915
+ async def _collect_objects(self):
916
+ if self.iterator is None:
917
+ self.gen_iterator()
918
+
919
+ async for partial_objects in self:
920
+ pass
921
+ return self.objects
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: miniopy-async
3
- Version: 1.18
3
+ Version: 1.20
4
4
  Summary: Asynchronous MinIO Client SDK for Python
5
5
  Home-page: https://github.com/hlf20010508/miniopy-async
6
6
  Author: L-ING
File without changes
File without changes
File without changes
File without changes