Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if strip_authentication:
netloc = netloc.split('@', 1)[-1]
# Normalizing AMP subdomains
if normalize_amp and netloc.startswith('amp-'):
netloc = netloc[4:]
# Dropping trailing slash
if strip_trailing_slash and path.endswith('/'):
path = path.rstrip('/')
# Quoting or not
if quoted:
path = quote(path)
query = quote(query, RESERVED_CHARACTERS)
fragment = quote(fragment, SAFE_CHARACTERS)
else:
path = unquote(path)
query = unquote(query)
fragment = unquote(fragment)
# Result
result = SplitResult(
scheme,
netloc.lower(),
path,
query,
fragment
)
if not unsplit:
return result
# Dropping authentication
if strip_authentication:
netloc = netloc.split('@', 1)[-1]
# Normalizing AMP subdomains
if normalize_amp and netloc.startswith('amp-'):
netloc = netloc[4:]
# Dropping trailing slash
if strip_trailing_slash and path.endswith('/'):
path = path.rstrip('/')
# Quoting or not
if quoted:
path = quote(path)
query = quote(query, RESERVED_CHARACTERS)
fragment = quote(fragment, SAFE_CHARACTERS)
else:
path = unquote(path)
query = unquote(query)
fragment = unquote(fragment)
# Result
result = SplitResult(
scheme,
netloc.lower(),
path,
query,
fragment
)
# Dropping authentication
if strip_authentication:
netloc = netloc.split('@', 1)[-1]
# Normalizing AMP subdomains
if normalize_amp and netloc.startswith('amp-'):
netloc = netloc[4:]
# Dropping trailing slash
if strip_trailing_slash and path.endswith('/'):
path = path.rstrip('/')
# Quoting or not
if quoted:
path = quote(path)
query = quote(query, RESERVED_CHARACTERS)
fragment = quote(fragment, SAFE_CHARACTERS)
else:
path = unquote(path)
query = unquote(query)
fragment = unquote(fragment)
# Result
result = SplitResult(
scheme,
netloc.lower(),
path,
query,
fragment
)
if not unsplit: