rclone-api 1.5.29__py3-none-any.whl → 1.5.30__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/__init__.py CHANGED
@@ -210,6 +210,23 @@ class Rclone:
210
210
  """
211
211
  return self.impl.obscure(password=password)
212
212
 
213
+ def config_show(
214
+ self, remote: str | None = None, obscure: bool = False, no_obscure: bool = False
215
+ ) -> list[Path] | Exception:
216
+ """Show the current configuration.
217
+
218
+ Args:
219
+ remote: Optional remote name to show configuration for
220
+ obscure: Show obscured passwords
221
+ no_obscure: Show passwords in plain text
222
+
223
+ Returns:
224
+ Configuration as text or an Exception if an error occurred
225
+ """
226
+ return self.impl.config_paths(
227
+ remote=remote, obscure=obscure, no_obscure=no_obscure
228
+ )
229
+
213
230
  def ls_stream(
214
231
  self,
215
232
  src: str,
rclone_api/config.py CHANGED
@@ -1,6 +1,7 @@
1
+ import os
1
2
  from dataclasses import dataclass, field
2
3
  from pathlib import Path
3
- from typing import Dict, List
4
+ from typing import Any, Dict, List
4
5
 
5
6
 
6
7
  @dataclass
@@ -56,8 +57,8 @@ class Config:
56
57
  return Parsed.parse(self.text)
57
58
 
58
59
 
59
- def find_conf_file() -> Path | None:
60
- import os
60
+ def find_conf_file(rclone: Any | None = None) -> Path | None:
61
+ from rclone_api.rclone_impl import RcloneImpl
61
62
 
62
63
  # if os.environ.get("RCLONE_CONFIG"):
63
64
  # return Path(os.environ["RCLONE_CONFIG"])
@@ -68,6 +69,16 @@ def find_conf_file() -> Path | None:
68
69
  return Path(os.environ["RCLONE_CONFIG"])
69
70
  if (conf := Path.cwd() / "rclone.conf").exists():
70
71
  return conf
72
+ if rclone is not None:
73
+ assert isinstance(rclone, RcloneImpl)
74
+ paths_or_err = rclone.config_paths()
75
+ if isinstance(paths_or_err, Exception):
76
+ return None
77
+ paths = paths_or_err
78
+ path: Path
79
+ for path in paths:
80
+ if path.exists():
81
+ return path
71
82
  return None
72
83
 
73
84