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
: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.
130
135
:type non_http_scheme: None or str, optional
131
136
132
-
:return: Returns a url stripped to (scheme)?+hostname+path. Returns empty string if appropriate.
137
+
:return: Returns a url stripped to (scheme)?+netloc+path. Returns empty string if appropriate.
133
138
:rtype: str
134
139
"""
135
140
ifnon_http_schemenotin [None, 'self']:
136
141
raiseValueError('non_http_scheme must be either `None` or `self`')
137
142
purl=urlparse(url)
143
+
144
+
_scheme=purl.scheme
138
145
scheme_out=''
139
-
ifscheme:
140
-
scheme_out=f'{purl.scheme}://'
141
-
returnf'{scheme_out}{purl.hostname}{purl.path}'
146
+
netloc_out=purl.netloc
147
+
path_out=purl.path
148
+
149
+
if_schemenotin ['http', 'https']:
150
+
ifnon_http_scheme=='self':
151
+
scheme=True
152
+
ifnon_http_schemeisNone:
153
+
# e.g. in the case of about:blank, the path is 'blank', but we want
0 commit comments