rclone-api 1.4.13__py2.py3-none-any.whl → 1.4.15__py2.py3-none-any.whl

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.
@@ -10,6 +10,9 @@ from rclone_api.s3.s3_multipart_uploader_by_copy import (
10
10
  )
11
11
  from rclone_api.types import SizeSuffix
12
12
 
13
+ _TIMEOUT_READ = 900
14
+ _TIMEOUT_CONNECTION = 900
15
+
13
16
 
14
17
  @dataclass
15
18
  class Args:
@@ -58,10 +61,14 @@ def do_finish_part(rclone: Rclone, info: InfoJson, dst: str) -> None:
58
61
  create_s3_client,
59
62
  )
60
63
 
61
- s3_creds: S3Credentials = rclone.impl.get_s3_credentials(remote=dst)
62
- s3_client: BaseClient = create_s3_client(
63
- s3_creds, S3Config(verbose=False, timeout_read=5 * 60)
64
+ s3_config = S3Config(
65
+ verbose=False,
66
+ timeout_read=_TIMEOUT_READ,
67
+ timeout_connection=_TIMEOUT_CONNECTION,
64
68
  )
69
+
70
+ s3_creds: S3Credentials = rclone.impl.get_s3_credentials(remote=dst)
71
+ s3_client: BaseClient = create_s3_client(s3_creds=s3_creds, s3_config=s3_config)
65
72
  s3_bucket = s3_creds.bucket_name
66
73
  is_done = info.fetch_is_done()
67
74
  assert is_done, f"Upload is not done: {info}"
@@ -115,8 +122,7 @@ def do_finish_part(rclone: Rclone, info: InfoJson, dst: str) -> None:
115
122
  destination_key=dst_key,
116
123
  chunk_size=chunksize.as_int(),
117
124
  final_size=size.as_int(),
118
- max_workers=50,
119
- retries=3,
125
+ max_workers=10,
120
126
  )
121
127
 
122
128
  # now check if the dst now exists, if so, delete the parts folder.
rclone_api/s3/api.py CHANGED
@@ -20,11 +20,11 @@ _MIN_THRESHOLD_FOR_CHUNKING = 5 * 1024 * 1024
20
20
 
21
21
 
22
22
  class S3Client:
23
- def __init__(self, credentials: S3Credentials, verbose: bool = False) -> None:
23
+ def __init__(self, s3_creds: S3Credentials, verbose: bool = False) -> None:
24
24
  self.verbose = verbose
25
- self.credentials: S3Credentials = credentials
25
+ self.credentials: S3Credentials = s3_creds
26
26
  self.client: BaseClient = create_s3_client(
27
- credentials, config=S3Config(verbose=verbose)
27
+ s3_creds=s3_creds, s3_config=S3Config(verbose=verbose)
28
28
  )
29
29
 
30
30
  def list_bucket_contents(self, bucket_name: str) -> None:
rclone_api/s3/create.py CHANGED
@@ -8,7 +8,7 @@ from botocore.config import Config
8
8
  from rclone_api.s3.types import S3Credentials, S3Provider
9
9
 
10
10
  _DEFAULT_BACKBLAZE_ENDPOINT = "https://s3.us-west-002.backblazeb2.com"
11
- _MAX_CONNECTIONS = 50
11
+ _MAX_CONNECTIONS = 10
12
12
  _TIMEOUT_READ = 120
13
13
  _TIMEOUT_CONNECT = 60
14
14
 
@@ -16,33 +16,30 @@ _TIMEOUT_CONNECT = 60
16
16
  @dataclass
17
17
  class S3Config:
18
18
  max_pool_connections: int | None = None
19
- max_connections: int | None = None
20
19
  timeout_connection: int | None = None
21
20
  timeout_read: int | None = None
22
21
  verbose: bool | None = None
23
22
 
24
23
  def resolve_defaults(self) -> None:
25
- if self.max_pool_connections is None:
26
- self.max_pool_connections = _MAX_CONNECTIONS
27
- if self.timeout_connection is None:
28
- self.timeout_connection = _TIMEOUT_CONNECT
29
- if self.timeout_read is None:
30
- self.timeout_read = _TIMEOUT_READ
31
- if self.verbose is None:
32
- self.verbose = False
24
+ self.max_pool_connections = self.max_pool_connections or _MAX_CONNECTIONS
25
+ self.timeout_connection = self.timeout_connection or _TIMEOUT_CONNECT
26
+ self.timeout_read = self.timeout_read or _TIMEOUT_READ
27
+ self.verbose = self.verbose or False
33
28
 
34
29
 
35
30
  # Create a Boto3 session and S3 client, this is back blaze specific.
36
31
  # Add a function if you want to use a different S3 provider.
37
32
  # If AWS support is added in a fork then please merge it back here.
38
- def _create_backblaze_s3_client(creds: S3Credentials, config: S3Config) -> BaseClient:
33
+ def _create_backblaze_s3_client(
34
+ s3_creds: S3Credentials, s3_config: S3Config
35
+ ) -> BaseClient:
39
36
  """Create and return an S3 client."""
40
- region_name = creds.region_name
41
- access_key = creds.access_key_id
42
- secret_key = creds.secret_access_key
43
- endpoint_url = creds.endpoint_url
37
+ region_name = s3_creds.region_name
38
+ access_key = s3_creds.access_key_id
39
+ secret_key = s3_creds.secret_access_key
40
+ endpoint_url = s3_creds.endpoint_url
44
41
  endpoint_url = endpoint_url or _DEFAULT_BACKBLAZE_ENDPOINT
45
- config.resolve_defaults()
42
+ s3_config.resolve_defaults()
46
43
  session = boto3.session.Session() # type: ignore
47
44
  return session.client(
48
45
  service_name="s3",
@@ -53,9 +50,9 @@ def _create_backblaze_s3_client(creds: S3Credentials, config: S3Config) -> BaseC
53
50
  config=Config(
54
51
  signature_version="s3v4",
55
52
  region_name=region_name,
56
- max_pool_connections=config.max_connections,
57
- read_timeout=config.timeout_read,
58
- connect_timeout=config.timeout_connection,
53
+ max_pool_connections=s3_config.max_pool_connections,
54
+ read_timeout=s3_config.timeout_read,
55
+ connect_timeout=s3_config.timeout_connection,
59
56
  # Note that BackBlase has a boko3 bug where it doesn't support the new
60
57
  # checksum header, the following line was an attempt of fix it on the newest
61
58
  # version of boto3, but it didn't work.
@@ -64,18 +61,20 @@ def _create_backblaze_s3_client(creds: S3Credentials, config: S3Config) -> BaseC
64
61
  )
65
62
 
66
63
 
67
- def _create_unknown_s3_client(creds: S3Credentials, config: S3Config) -> BaseClient:
64
+ def _create_unknown_s3_client(
65
+ s3_creds: S3Credentials, s3_config: S3Config
66
+ ) -> BaseClient:
68
67
  """Create and return an S3 client."""
69
- access_key = creds.access_key_id
70
- secret_key = creds.secret_access_key
71
- endpoint_url = creds.endpoint_url
68
+ access_key = s3_creds.access_key_id
69
+ secret_key = s3_creds.secret_access_key
70
+ endpoint_url = s3_creds.endpoint_url
72
71
  if (endpoint_url is not None) and not (endpoint_url.startswith("http")):
73
- if config.verbose:
72
+ if s3_config.verbose:
74
73
  warnings.warn(
75
74
  f"Endpoint URL is schema naive: {endpoint_url}, assuming HTTPS"
76
75
  )
77
76
  endpoint_url = f"https://{endpoint_url}"
78
- config.resolve_defaults()
77
+ s3_config.resolve_defaults()
79
78
  session = boto3.session.Session() # type: ignore
80
79
  return session.client(
81
80
  service_name="s3",
@@ -84,25 +83,25 @@ def _create_unknown_s3_client(creds: S3Credentials, config: S3Config) -> BaseCli
84
83
  endpoint_url=endpoint_url,
85
84
  config=Config(
86
85
  signature_version="s3v4",
87
- region_name=creds.region_name,
88
- max_pool_connections=config.max_connections,
89
- read_timeout=config.timeout_read,
90
- connect_timeout=config.timeout_connection,
86
+ region_name=s3_creds.region_name,
87
+ max_pool_connections=s3_config.max_pool_connections,
88
+ read_timeout=s3_config.timeout_read,
89
+ connect_timeout=s3_config.timeout_connection,
91
90
  ),
92
91
  )
93
92
 
94
93
 
95
94
  def create_s3_client(
96
- credentials: S3Credentials, config: S3Config | None = None
95
+ s3_creds: S3Credentials, s3_config: S3Config | None = None
97
96
  ) -> BaseClient:
98
97
  """Create and return an S3 client."""
99
- config = config or S3Config()
100
- provider = credentials.provider
98
+ s3_config = s3_config or S3Config()
99
+ provider = s3_creds.provider
101
100
  if provider == S3Provider.BACKBLAZE:
102
- if config.verbose:
101
+ if s3_config.verbose:
103
102
  print("Creating BackBlaze S3 client")
104
- return _create_backblaze_s3_client(creds=credentials, config=config)
103
+ return _create_backblaze_s3_client(s3_creds=s3_creds, s3_config=s3_config)
105
104
  else:
106
- if config.verbose:
105
+ if s3_config.verbose:
107
106
  print("Creating generic/unknown S3 client")
108
- return _create_unknown_s3_client(creds=credentials, config=config)
107
+ return _create_unknown_s3_client(s3_creds=s3_creds, s3_config=s3_config)
@@ -240,7 +240,7 @@ class S3MultiPartUploader:
240
240
  destination_key: str,
241
241
  chunk_size: int,
242
242
  final_size: int,
243
- retries: int = 3,
243
+ retries: int = 100,
244
244
  ) -> str:
245
245
  """
246
246
  Finish a multipart upload by copying parts from existing S3 objects.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.4.13
3
+ Version: 1.4.15
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  License: BSD 3-Clause License
@@ -27,7 +27,7 @@ rclone_api/util.py,sha256=9w_m6W62l_X42Jw5q8p_p30h-QoxAqufvnCLI4PTMOE,7056
27
27
  rclone_api/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
28
28
  rclone_api/cmd/analyze.py,sha256=RHbvk1G5ZUc3qLqlm1AZEyQzd_W_ZjcbCNDvW4YpTKQ,1252
29
29
  rclone_api/cmd/copy_large_s3.py,sha256=B17GliDQyAauNglJCpsey0d3eArT2DAcT9g684TMQk8,3514
30
- rclone_api/cmd/copy_large_s3_finish.py,sha256=7bDaUZ0forOqR4JOT1eoMBF_2qtifM9GcLK_he53cw4,4877
30
+ rclone_api/cmd/copy_large_s3_finish.py,sha256=6fP95UU4ueBkGmkhX4YDu1ze0HIJlgYhCGF5z9IFc3k,5015
31
31
  rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,741
32
32
  rclone_api/cmd/save_to_db.py,sha256=ylvnhg_yzexM-m6Zr7XDiswvoDVSl56ELuFAdb9gqBY,1957
33
33
  rclone_api/db/__init__.py,sha256=OSRUdnSWUlDTOHmjdjVmxYTUNpTbtaJ5Ll9sl-PfZg0,40
@@ -37,20 +37,20 @@ rclone_api/detail/copy_file_parts.py,sha256=dpqZ0d7l195dZg6Vob2Ty43Uah1v0ozQu5kM
37
37
  rclone_api/detail/walk.py,sha256=-54NVE8EJcCstwDoaC_UtHm73R2HrZwVwQmsnv55xNU,3369
38
38
  rclone_api/experimental/flags.py,sha256=qCVD--fSTmzlk9hloRLr0q9elzAOFzPsvVpKM3aB1Mk,2739
39
39
  rclone_api/experimental/flags_base.py,sha256=ajU_czkTcAxXYU-SlmiCfHY7aCQGHvpCLqJ-Z8uZLk0,2102
40
- rclone_api/s3/api.py,sha256=nIjOskTgTlbksbBHgF27ExFEYheCT_OvcdYl6FqRAto,4058
40
+ rclone_api/s3/api.py,sha256=owoQ1H-R0hXcUozxC6sl53D7NmMOewHk2pUxK-ye8ms,4061
41
41
  rclone_api/s3/basic_ops.py,sha256=hK3366xhVEzEcjz9Gk_8lFx6MRceAk72cax6mUrr6ko,2104
42
42
  rclone_api/s3/chunk_task.py,sha256=waEYe-iYQ1_BR3NCS4BrzVrK9UANvH1EcbXx2I6Z_NM,6839
43
- rclone_api/s3/create.py,sha256=NsJtyOSTR_4kvwdojrzrg8LIjMVRuOsTGt4KkUrV0OM,4015
44
- rclone_api/s3/s3_multipart_uploader_by_copy.py,sha256=KNEWG3CrM8lVWd2b0dA6WT5LO3gEEXNk2tA6Uk9Vi7I,8701
43
+ rclone_api/s3/create.py,sha256=_Q-faQ4Zl8XKTB28gireRxVXWP-YNxoAK4bligxDtiI,3998
44
+ rclone_api/s3/s3_multipart_uploader_by_copy.py,sha256=JjMSG9XHiBlKnihPKw43SBYsh-NBqg5FZ4rnGU7j48s,8703
45
45
  rclone_api/s3/types.py,sha256=cYI5MbXRNdT-ps5kGIRQaYrseHyx_ozT4AcwBABTKwk,1616
46
46
  rclone_api/s3/upload_file_multipart.py,sha256=V7syKjFyVIe4U9Ahl5XgqVTzt9akiew3MFjGmufLo2w,12503
47
47
  rclone_api/s3/multipart/file_info.py,sha256=8v_07_eADo0K-Nsv7F0Ac1wcv3lkIsrR3MaRCmkYLTQ,105
48
48
  rclone_api/s3/multipart/finished_piece.py,sha256=9nMWnVZ8S99wi2VFQsm1h1ZHqmebkhMGgd2s56wNj9w,1331
49
49
  rclone_api/s3/multipart/upload_info.py,sha256=d6_OfzFR_vtDzCEegFfzCfWi2kUBUV4aXZzqAEVp1c4,1874
50
50
  rclone_api/s3/multipart/upload_state.py,sha256=f-Aq2NqtAaMUMhYitlICSNIxCKurWAl2gDEUVizLIqw,6019
51
- rclone_api-1.4.13.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
52
- rclone_api-1.4.13.dist-info/METADATA,sha256=UFK0tBZDL5_d8X-NpHskBsPk7YxWHo5ZqMI0Quqwsic,4628
53
- rclone_api-1.4.13.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
54
- rclone_api-1.4.13.dist-info/entry_points.txt,sha256=fJteOlYVwgX3UbNuL9jJ0zUTuX2O79JFAeNgK7Sw7EQ,255
55
- rclone_api-1.4.13.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
56
- rclone_api-1.4.13.dist-info/RECORD,,
51
+ rclone_api-1.4.15.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
52
+ rclone_api-1.4.15.dist-info/METADATA,sha256=yC0hOJ09OMTVwf98k6NEfy7-gmlwu4IqWmWdnfUP67Q,4628
53
+ rclone_api-1.4.15.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
54
+ rclone_api-1.4.15.dist-info/entry_points.txt,sha256=fJteOlYVwgX3UbNuL9jJ0zUTuX2O79JFAeNgK7Sw7EQ,255
55
+ rclone_api-1.4.15.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
56
+ rclone_api-1.4.15.dist-info/RECORD,,