rclone-bin-api 1.0.3__tar.gz → 1.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rclone-bin-api
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Rclone API for Python including the Rclone binaries.
5
5
  Author-email: Michael G <me@mgineer85.de>
6
6
  Maintainer-email: Michael G <me@mgineer85.de>
@@ -2,7 +2,7 @@
2
2
  [project]
3
3
  name = "rclone-bin-api"
4
4
  description = "Rclone API for Python including the Rclone binaries."
5
- version = "1.0.3"
5
+ version = "1.0.4"
6
6
  authors = [{ name = "Michael G", email = "me@mgineer85.de" }]
7
7
  maintainers = [{ name = "Michael G", email = "me@mgineer85.de" }]
8
8
  requires-python = ">=3.11"
@@ -125,6 +125,8 @@ class RcloneApi:
125
125
  assert not (not fs.endswith(":") and not Path(fs).is_absolute()), f"fs must be absolute when remote is a local path: {fs=} {remote=}"
126
126
 
127
127
  def _post(self, endpoint: str, data: dict[str, Any] | None = None):
128
+ TIMEOUT = 90
129
+
128
130
  req = urllib.request.Request(
129
131
  url=f"{self.__connect_addr}/{endpoint}",
130
132
  data=json.dumps(data or {}).encode("utf-8"),
@@ -133,7 +135,7 @@ class RcloneApi:
133
135
  )
134
136
 
135
137
  try:
136
- with urllib.request.urlopen(req, timeout=20) as resp:
138
+ with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:
137
139
  raw: bytes = resp.read()
138
140
  response_json = json.loads(raw.decode("utf-8"))
139
141
 
@@ -141,6 +143,8 @@ class RcloneApi:
141
143
  raw: bytes = exc.read()
142
144
  response_json = json.loads(raw.decode("utf-8"))
143
145
  raise RcloneProcessException.from_dict(response_json) from exc
146
+ except TimeoutError as exc:
147
+ raise RcloneConnectionException(f"Operation timed out after {TIMEOUT}s. To copy large files consider using _async methods.") from exc
144
148
  except Exception as exc: # all other errors
145
149
  raise RcloneConnectionException(f"Issue connecting to rclone RC server, error: {exc}") from exc
146
150
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rclone-bin-api
3
- Version: 1.0.3
3
+ Version: 1.0.4
4
4
  Summary: Rclone API for Python including the Rclone binaries.
5
5
  Author-email: Michael G <me@mgineer85.de>
6
6
  Maintainer-email: Michael G <me@mgineer85.de>
File without changes
File without changes
File without changes