You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example `https://my.domain.net/a/path/to/a/file.html#anchor?a=1
123
-
becomes `my.domain.net/a/path/to/a/file.html`
122
+
For example ``https://my.domain.net/a/path/to/a/file.html#anchor?a=1``
123
+
becomes ``my.domain.net/a/path/to/a/file.html``
124
124
125
125
126
126
URL parsing is done using std lib urllib.parse.urlparse
127
-
Using netloc means that a port is included, for example, if it was in the path.
128
-
This makes it cleaner to think about just the scheme and params being stripped.
127
+
Using netloc means that a port is included, for example,
128
+
if it was in the path.
129
+
The method strips just the beginning and end being stripped.
129
130
130
131
:param url: URL to be parsed
131
132
:type url: str
132
-
:param scheme: If True, scheme will be prepended in returned result, defaults to False
133
+
:param scheme: If True, scheme will be prepended in
134
+
returned result, defaults to False
133
135
:type scheme: bool, optional
134
-
:param non_http_scheme: Action to take if scheme is not http or https e.g. file: or 'about:blank'. If None, return empty string. If 'self', return the original URL. Default is None.
135
-
:type non_http_scheme: None or str, optional
136
-
137
-
:return: Returns a url stripped to (scheme)?+netloc+path. Returns empty string if appropriate.
136
+
:param non_http_scheme: Action to take if scheme is not
137
+
``http`` or ``https`` e.g. ``file:`` or ``about:blank``.
138
+
If None, return empty string.
139
+
If ``self``, return the original URL.
140
+
Default is None.
141
+
:type non_http_scheme: None or ``"self"``, optional
142
+
143
+
:return: Returns a url stripped to (scheme)?+netloc+path.
0 commit comments