The sftp: scheme
Needs uripath: pip install "sftppath[uri]".
sftppath.uri
The sftp: scheme of uripath: SFTPURIPath, a URI path that delegates to
SFTPPath, and SFTPURIBackend, the options its connections are made with.
Importing this module needs uripath: pip install "sftppath[uri]". uripath
loads it by itself, through the uripath.schemes entry point, the first time a
path of the scheme is used.
SFTPURIBackend(backend_class=None, **options)
Bases: object
How the connections of sftp: paths are made: the backend class and the
options of its constructor (connect_opts, ssh_config, timeout, ...).
backend_for(source) builds the backend for a URI's server and account,
once for as long as a path or a connection holds it, so paths to one server
share their connections.
backend_class is a BaseSFTPBackend subclass; without one, the class
SFTPPATH_BACKEND selects is used. The user, password and port of the URI
are given to it; options are given as they are.
A context manager: leaving the block calls close().
Source code in src/sftppath/uri.py
69 70 71 72 73 74 75 76 77 78 79 80 81 | |
backend_class = backend_class
instance-attribute
options = options
instance-attribute
backend_for(source)
The backend for the server and account source names.
Source code in src/sftppath/uri.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
close()
Closes every connection the paths of this backend hold, whichever thread opened it, and returns when they are closed. Harmless when called again; a later use connects afresh.
Source code in src/sftppath/uri.py
104 105 106 107 108 109 110 111 | |
SFTPURIPath
Bases: DelegatingURIPath
sftp: scheme: full read/write access, done by an SFTPPath on the
connections of backend (an SFTPURIBackend, or a BaseSFTPBackend used
as it is for every path whatever host the URI names). See "backend
selection" in SFTPPath; one of its SSH-library extras is needed.
ssh_config -- default ~/.ssh/config, None for none, a path or an
iterable of paths -- is carried to every path derived from this one on the
same endpoint and dropped, with the backend, when the derived path is on
another host.
backend
instance-attribute
checksum(algorithm='md5')
Source code in src/sftppath/uri.py
337 338 339 | |
copy(target, *, overwrite=False, follow_symlinks=True, preserve_metadata=True, recursive=False, ignore_error=None, progress=None, on_error=None)
Copy with the backend's concurrent fan-out: a directory copied to a
path of the same server and tree is done by the native walk of
SFTPPath.copy(); every other copy is Path.copy(). progress is not
called during the native fan-out.
Source code in src/sftppath/uri.py
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
hardlink_to(target)
Source code in src/sftppath/uri.py
324 325 326 327 328 329 330 331 | |
readlink()
Source code in src/sftppath/uri.py
315 316 317 318 319 320 321 322 | |
rename(target)
Source code in src/sftppath/uri.py
341 342 343 344 345 346 347 348 349 350 351 | |
replace(target)
Rename this entry to target, replacing what is there, and return
target as a path. Onto a path of this server it is the replace() of
SFTPPath; onto anything else it is Path.replace(), which
move(overwrite=True) uses too.
Source code in src/sftppath/uri.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
rm(recursive=False, missing_ok=False, ignore_error=False, *, follow_symlinks=False, follow_binds=False)
Source code in src/sftppath/uri.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
stat(*, follow_symlinks=True)
Source code in src/sftppath/uri.py
296 297 298 299 300 301 302 303 304 305 306 307 | |
supported_checksums()
Source code in src/sftppath/uri.py
333 334 335 | |
with_source(source)
Source code in src/sftppath/uri.py
237 238 239 240 241 | |