string

New in version 1.1.0.

String parsing, formatting, etc.

smisk.util.string.normalize_url(url, ref_base_url=None)
Parameters:
  • url (URL | string) – An absolute URL, absolute path or relative path.
  • ref_base_url (URL) – Default absolute URL used to expand a path to a full URL. Uses smisk.core.request.url if not set.
Return type:

URL

smisk.util.string.parse_qvalue_header(s, accept_any_equals='*/*', partial_endswith='/*', return_true_if_accepts_charset=None)
Parse a qvalue HTTP header
smisk.util.string.strip_filename_extension(fn)

Remove any file extension from filename.

Return type:string
smisk.util.string.tokenize_path(path)

Deconstruct a URI path into standardized tokens.

Parameters:
  • path (string) – A pathname
Return type:

list