api
chunked_upload(nc_client, local_source_file, remote_path, chunk_size=_DEFAULT_CHUNK_SIZE, keep_mtime=True)
Upload file to remote by creating a folder containing chunks if needed.
Chunks are enumerated from 000000000000001 until the final chunk.
The folder will be named remote_path
+ _chunked
.
If the file is smaller than the chunk_size
, will try to upload
file in one piece.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nc_client |
Client
|
Client with shared folder |
required |
local_source_file |
Path
|
Local file to upload |
required |
remote_path |
str
|
Path where file be stored remotely. |
required |
chunk_size |
int
|
Chunk size in bytes. |
_DEFAULT_CHUNK_SIZE
|
keep_mtime |
bool
|
If True sends modified time in header. |
True
|
Returns:
Type | Description |
---|---|
bool
|
True if successful |
Raises:
Type | Description |
---|---|
ServerError
|
owncloud.owncloud.HTTPResponseError if server throws error |
Source code in /home/docs/checkouts/readthedocs.org/user_builds/nephelai/envs/stable/lib/python3.10/site-packages/nephelai/api.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
create_nc_folders(my_dir, nc_client)
Create nextcloud folders using given owncloud client.
Will create all subpaths if needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
my_dir |
Path
|
Full path to create |
required |
nc_client |
Client
|
Client with shared folder |
required |
Returns:
Type | Description |
---|---|
bool
|
True if folders did not exist, False otherwise |
Source code in /home/docs/checkouts/readthedocs.org/user_builds/nephelai/envs/stable/lib/python3.10/site-packages/nephelai/api.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
download(remote_path, local_path=None)
Download file from remote.
If the file is chunked it will be reconstructed while downloading. If no local path is given it will be written in the current directory. If it exists it will be replaced.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
remote_path |
str
|
Path where the file lies in the shared folder |
required |
local_path |
Optional[str]
|
Path where file should downloaded to |
None
|
Returns:
Type | Description |
---|---|
Optional[bool]
|
True if successful, else None |
Source code in /home/docs/checkouts/readthedocs.org/user_builds/nephelai/envs/stable/lib/python3.10/site-packages/nephelai/api.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
upload(file_to_upload, nc_path, chunk_size='100MiB', debug=False)
Upload to password protected shared folder.
If file is larger than chunk_size
a folder will be created,
and the chunks will be uploaded there.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_to_upload |
Union[Path, str]
|
The file to upload |
required |
nc_path |
str
|
The remote path |
required |
chunk_size |
Union[int, str]
|
Chunk size as bytes or as human readable string |
'100MiB'
|
debug |
bool
|
If True, show debug info |
False
|
Returns:
Type | Description |
---|---|
Optional[bool]
|
True if successful, else None |
Source code in /home/docs/checkouts/readthedocs.org/user_builds/nephelai/envs/stable/lib/python3.10/site-packages/nephelai/api.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|