rclone-api 1.5.11__py3-none-any.whl → 1.5.12__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/http_server.py +24 -0
- {rclone_api-1.5.11.dist-info → rclone_api-1.5.12.dist-info}/METADATA +1 -1
- {rclone_api-1.5.11.dist-info → rclone_api-1.5.12.dist-info}/RECORD +7 -7
- {rclone_api-1.5.11.dist-info → rclone_api-1.5.12.dist-info}/WHEEL +1 -1
- {rclone_api-1.5.11.dist-info → rclone_api-1.5.12.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.5.11.dist-info → rclone_api-1.5.12.dist-info}/licenses/LICENSE +0 -0
- {rclone_api-1.5.11.dist-info → rclone_api-1.5.12.dist-info}/top_level.txt +0 -0
rclone_api/http_server.py
CHANGED
@@ -46,6 +46,18 @@ class HttpServer:
|
|
46
46
|
file.seek(0)
|
47
47
|
return file.read()
|
48
48
|
|
49
|
+
def exists(self, path: str) -> bool:
|
50
|
+
"""Check if the file exists on the server."""
|
51
|
+
try:
|
52
|
+
assert self.process is not None
|
53
|
+
# response = httpx.head(f"{self.url}/{path}")
|
54
|
+
url = self._get_file_url(path)
|
55
|
+
response = httpx.head(url)
|
56
|
+
return response.status_code == 200
|
57
|
+
except Exception as e:
|
58
|
+
warnings.warn(f"Failed to check if {self.url}/{path} exists: {e}")
|
59
|
+
return False
|
60
|
+
|
49
61
|
def size(self, path: str) -> int | Exception:
|
50
62
|
"""Get size of the file from the server."""
|
51
63
|
try:
|
@@ -60,6 +72,18 @@ class HttpServer:
|
|
60
72
|
warnings.warn(f"Failed to get size of {self.url}/{path}: {e}")
|
61
73
|
return e
|
62
74
|
|
75
|
+
def put(self, path: str, data: bytes) -> Exception | None:
|
76
|
+
"""Put bytes to the server."""
|
77
|
+
try:
|
78
|
+
assert self.process is not None
|
79
|
+
url = self._get_file_url(path)
|
80
|
+
response = httpx.put(url, content=data, timeout=_TIMEOUT)
|
81
|
+
response.raise_for_status()
|
82
|
+
return None
|
83
|
+
except Exception as e:
|
84
|
+
warnings.warn(f"Failed to put {path} to {self.url}: {e}")
|
85
|
+
return e
|
86
|
+
|
63
87
|
def download(
|
64
88
|
self, path: str, dst: Path, range: Range | None = None
|
65
89
|
) -> Path | Exception:
|
@@ -14,7 +14,7 @@ rclone_api/file_part.py,sha256=i6ByS5_sae8Eba-4imBVTxd-xKC8ExWy7NR8QGr0ors,6155
|
|
14
14
|
rclone_api/file_stream.py,sha256=_W3qnwCuigqA0hzXl2q5pAxSZDRaUSwet4BkT0lpnzs,1431
|
15
15
|
rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
|
16
16
|
rclone_api/group_files.py,sha256=H92xPW9lQnbNw5KbtZCl00bD6iRh9yRbCuxku4j_3dg,8036
|
17
|
-
rclone_api/http_server.py,sha256=
|
17
|
+
rclone_api/http_server.py,sha256=Rc7wHn4XeyJCwNRe6pr88vHtbJxFGdYNcgRVYNuUG3E,9784
|
18
18
|
rclone_api/install.py,sha256=Xb1BRn8rQcSpSd4dzmvIOELP2zM2DytUeIZ6jzv738A,2893
|
19
19
|
rclone_api/log.py,sha256=VZHM7pNSXip2ZLBKMP7M1u-rp_F7zoafFDuR8CPUoKI,1271
|
20
20
|
rclone_api/mount.py,sha256=LZqEhuKZunbWVqmsOIqkkCotaxWJpdFRS1InXveoU5E,1428
|
@@ -53,9 +53,9 @@ rclone_api/s3/multipart/upload_parts_inline.py,sha256=V7syKjFyVIe4U9Ahl5XgqVTzt9
|
|
53
53
|
rclone_api/s3/multipart/upload_parts_resumable.py,sha256=diJoUpVYow6No_dNgOZIYVsv43k4evb6zixqpzWJaUk,9771
|
54
54
|
rclone_api/s3/multipart/upload_parts_server_side_merge.py,sha256=Fp2pdrs5dONQI9LkfNolgAGj1-Z2V1SsRd0r0sreuXI,18040
|
55
55
|
rclone_api/s3/multipart/upload_state.py,sha256=f-Aq2NqtAaMUMhYitlICSNIxCKurWAl2gDEUVizLIqw,6019
|
56
|
-
rclone_api-1.5.
|
57
|
-
rclone_api-1.5.
|
58
|
-
rclone_api-1.5.
|
59
|
-
rclone_api-1.5.
|
60
|
-
rclone_api-1.5.
|
61
|
-
rclone_api-1.5.
|
56
|
+
rclone_api-1.5.12.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
57
|
+
rclone_api-1.5.12.dist-info/METADATA,sha256=7MG4gBbQ1cKx9EHM4hyR4LhpOuZVyE55YKfjQYNEox4,32657
|
58
|
+
rclone_api-1.5.12.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
59
|
+
rclone_api-1.5.12.dist-info/entry_points.txt,sha256=fJteOlYVwgX3UbNuL9jJ0zUTuX2O79JFAeNgK7Sw7EQ,255
|
60
|
+
rclone_api-1.5.12.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
61
|
+
rclone_api-1.5.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|