Index
Overview
url parses URLs and implements query escaping.
Functions
def parse
parse(rawurl) URL
Parse parses rawurl into a URL structure.
Arguments
name | type | description |
---|---|---|
rawurl | string | rawurl may be relative (a path, without a host) or absolute(starting with a scheme). Trying to parse a hostname and pathwithout a scheme is invalid but may not necessarily return anerror, due to parsing ambiguities. |
def path_escape
path_escape(s)
escapes the string so it can be safely placed inside a URL path segment, replacing special characters (including /) with %XX sequences as needed.
Arguments
name | type | description |
---|---|---|
s | string |
def path_escape
path_escape(s)
escapes the string so it can be safely placed inside a URL query.
Arguments
name | type | description |
---|---|---|
s | string |
def path_unescape
path_unescape(s)
does the inverse transformation of path_escape, converting each 3-byte encoded substring of the form “%AB” into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits. path_unescape is identical to query_unescape except that it does not unescape ‘+’ to ' ' (space).
Arguments
name | type | description |
---|---|---|
s | string |
def path_unescape
path_unescape(s)
does the inverse transformation of query_escape, converting each 3-byte encoded substring of the form “%AB” into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits.
Arguments
name | type | description |
---|---|---|
s | string |
Types
type URL
Represents a parsed URL (technically, a URI reference).
Properties
name | type | description |
---|---|---|
scheme | string | |
opaque | string | Encoded opaque data. |
username | string | Username information. |
password | string | Password information. |
host | string | Host or host:port. |
path | string | Path (relative paths may omit leading slash). |
raw_query | string | Encoded query values, without ‘?'. |
fragment | string | Fragment for references, without ‘#'. |