rclone-api 1.5.39__py3-none-any.whl → 1.5.41__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.
rclone_api/config.py CHANGED
@@ -60,6 +60,16 @@ class Config:
60
60
  def parse(self) -> Parsed:
61
61
  return Parsed.parse(self.text)
62
62
 
63
+ def _auto_convert_if_json(self) -> None:
64
+ try:
65
+ text = _json_to_rclone_config_str_or_raise(self.text)
66
+ self.text = text
67
+ except Exception:
68
+ pass
69
+
70
+ def __post_init__(self) -> None:
71
+ self._auto_convert_if_json()
72
+
63
73
 
64
74
  def find_conf_file(rclone: Any | None = None) -> Path | None:
65
75
  import subprocess
@@ -168,8 +178,13 @@ def parse_rclone_config(content: str) -> Parsed:
168
178
  # }
169
179
 
170
180
 
171
- def _json_to_rclone_config_str_or_raise(json_data: dict) -> str:
181
+ def _json_to_rclone_config_str_or_raise(json_data: dict | str) -> str:
172
182
  """Convert JSON data to rclone config."""
183
+ import json
184
+
185
+ if isinstance(json_data, str):
186
+ json_data = json.loads(json_data)
187
+ assert isinstance(json_data, dict)
173
188
  out = ""
174
189
  for key, value in json_data.items():
175
190
  out += f"[{key}]\n"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rclone_api
3
- Version: 1.5.39
3
+ Version: 1.5.41
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  License: BSD 3-Clause License
@@ -47,6 +47,14 @@ You can have [rclone](https://rclone.org/) in your path or else the api will dow
47
47
 
48
48
  There is a virtual file system called `FSPath` which emulates common operators for `pathlib.Path`. You can get an instance of an `FSPath` from an `Rclone` instance using the `rclone.cwd("src:path/to")` function.
49
49
 
50
+ ## ENVS
51
+
52
+ * RCLONE_CONFIG
53
+ * path string of the rclone.conf text file
54
+
55
+ * RCLONE_CONFIG_JSON
56
+ * string content of rclone config.json
57
+
50
58
  # Install
51
59
 
52
60
  `pip install rclone-api`
@@ -1,7 +1,7 @@
1
1
  rclone_api/__init__.py,sha256=CXAOOm1s_EQmaqPUKdIJsxfcFEvv-5UWLl0e04lqpF4,33083
2
2
  rclone_api/cli.py,sha256=dibfAZIh0kXWsBbfp3onKLjyZXo54mTzDjUdzJlDlWo,231
3
3
  rclone_api/completed_process.py,sha256=_IZ8IWK7DM1_tsbDEkH6wPZ-bbcrgf7A7smls854pmg,1775
4
- rclone_api/config.py,sha256=wJDg-I_rVUMImAjSuTK0Rh4ICwxWl7AK9odQt9n-Ll4,5454
4
+ rclone_api/config.py,sha256=FXEpsy72FfbJoKIpE_wFKQor6aKDmLDAoxMHebGvmJM,5865
5
5
  rclone_api/convert.py,sha256=Mx9Qo7zhkOedJd8LdhPvNGHp8znJzOk4f_2KWnoGc78,1012
6
6
  rclone_api/deprecated.py,sha256=qWKpnZdYcBK7YQZKuVoWWXDwi-uqiAtbjgPcci_efow,590
7
7
  rclone_api/diff.py,sha256=tMoJMAGmLSE6Q_7QhPf6PnCzb840djxMZtDmhc2GlGQ,5227
@@ -54,9 +54,9 @@ rclone_api/s3/multipart/upload_parts_inline.py,sha256=V7syKjFyVIe4U9Ahl5XgqVTzt9
54
54
  rclone_api/s3/multipart/upload_parts_resumable.py,sha256=6-nlMclS8jyVvMvFbQDcZOX9MY1WbCcKA_s9bwuYxnk,9793
55
55
  rclone_api/s3/multipart/upload_parts_server_side_merge.py,sha256=WwVxunCFNvjSiskNCDLfwtVHzmDmN-TsrF0rRTfZnRY,17494
56
56
  rclone_api/s3/multipart/upload_state.py,sha256=f-Aq2NqtAaMUMhYitlICSNIxCKurWAl2gDEUVizLIqw,6019
57
- rclone_api-1.5.39.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
58
- rclone_api-1.5.39.dist-info/METADATA,sha256=rA6FILFgNct_-amv3Tyq6vdNdPkpe6WHFAnaiiCp__w,36055
59
- rclone_api-1.5.39.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
60
- rclone_api-1.5.39.dist-info/entry_points.txt,sha256=fJteOlYVwgX3UbNuL9jJ0zUTuX2O79JFAeNgK7Sw7EQ,255
61
- rclone_api-1.5.39.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
62
- rclone_api-1.5.39.dist-info/RECORD,,
57
+ rclone_api-1.5.41.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
58
+ rclone_api-1.5.41.dist-info/METADATA,sha256=iOhBN3sdp9xi4b-FqUhK__KtHraXXclzu28nkVGOhdQ,36197
59
+ rclone_api-1.5.41.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
60
+ rclone_api-1.5.41.dist-info/entry_points.txt,sha256=fJteOlYVwgX3UbNuL9jJ0zUTuX2O79JFAeNgK7Sw7EQ,255
61
+ rclone_api-1.5.41.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
62
+ rclone_api-1.5.41.dist-info/RECORD,,