http: and dav:
Both need the http extra.
pathlib_next.uri.schemes.http
DEFAULT_TIMEOUT = (10, 60)
module-attribute
(connect, read) timeout, in seconds, HttpBackend sends with every
request unless the caller supplies timeout (via with_session(...,
timeout=...) / requests_args, or per request); timeout=None there
restores requests' unbounded wait.
HttpBackend
Bases: NamedTuple
Per-instance requests.Session + extra request kwargs shared by an
HttpPath tree (see with_session()).
Every request gets timeout=DEFAULT_TIMEOUT ((10, 60) seconds)
unless requests_args or the call supplies timeout (None there
waits forever). URL userinfo (http://user:password@host/) is never
sent inside the request URL: it is stripped and sent as auth=(user,
password) -- unless requests_args/the call pass their own auth
or the session has session.auth set, which win as they did before.
append_mode = 'rewrite'
class-attribute
instance-attribute
requests_args
instance-attribute
session
instance-attribute
write_method = 'PUT'
class-attribute
instance-attribute
request(method, uri, **kwargs)
Source code in src/pathlib_next/uri/schemes/http.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | |
HttpPath(*uris, **options)
Bases: UriPath
http/https scheme: read/write access over HTTP (PUT/DELETE
for writes/deletes, configurable via with_session()), listing
directories by scraping an Apache/nginx-style HTML index with a
zero-dependency in-house parser (_DirectoryListingParser). Requires
the http extra.
Source code in src/pathlib_next/uri/__init__.py
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 194 195 196 197 198 199 200 201 | |
backend
instance-attribute
rmdir()
Source code in src/pathlib_next/uri/schemes/http.py
949 950 951 952 953 954 955 956 957 958 959 960 961 962 | |
stat(*, follow_symlinks=True, walk_up_last_modified=False)
Source code in src/pathlib_next/uri/schemes/http.py
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | |
unlink(missing_ok=False)
Source code in src/pathlib_next/uri/schemes/http.py
924 925 926 927 928 929 930 931 932 933 934 935 936 | |
with_session(session, write_method='PUT', append_mode='rewrite', **requests_args)
Source code in src/pathlib_next/uri/schemes/http.py
964 965 966 967 968 969 970 971 972 973 | |
pathlib_next.uri.schemes.dav
DavPath(*uris, **options)
Bases: HttpPath
dav:/davs: scheme: WebDAV (RFC 4918) over HTTP(S). Extends
HttpPath with PROPFIND (stat/listdir -- real directory metadata,
replacing HttpPath's HTML-index scraping) and PUT/DELETE/MKCOL/MOVE
(full write support). Requests go to the equivalent http:/https:
URL (_wire_uri()); as_uri() still reports dav:/davs:. Reuses
HttpPath's HttpBackend (session + requests_args) and the http
extra -- no new dependency.
rmdir() enforces pathlib's "must be empty" contract with a depth-1
PROPFIND before DELETE (WebDAV DELETE is recursive by spec, RFC 4918,
unlike pathlib.Path.rmdir()). The native recursive DELETE is still
available -- and cheaper than the base class's client-side walk -- via
rm(recursive=True), overridden below to issue a single request.
Source code in src/pathlib_next/uri/__init__.py
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 194 195 196 197 198 199 200 201 | |