Documentation
¶
Index ¶
- Constants
- func LoadModule() (starlark.StringDict, error)
- func Parse(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func PathEscape(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func PathUnescape(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func QueryEscape(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- func QueryUnescape(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, ...) (starlark.Value, error)
- type URL
Constants ¶
const ( // ModuleName defines the expected name for this Module when used // in starlark's load() function, eg: load('io/ioutil', 'json') ModuleName = "url" )
Variables ¶
This section is empty.
Functions ¶
func LoadModule ¶
func LoadModule() (starlark.StringDict, error)
LoadModule loads the url module. It is concurrency-safe and idempotent.
outline: url url parses URLs and implements query escaping. path: url
func Parse ¶
func Parse( thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple, ) (starlark.Value, error)
Parse parses rawurl into a URL structure.
outline: url
functions:
parse(rawurl) URL
Parse parses rawurl into a URL structure.
params:
rawurl string
rawurl may be relative (a path, without a host) or absolute
(starting with a scheme). Trying to parse a hostname and path
without a scheme is invalid but may not necessarily return an
error, due to parsing ambiguities.
func PathEscape ¶
func PathEscape(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
PathEscape escapes the string so it can be safely placed inside a URL path segment, replacing special characters (including /) with %XX sequences as needed.
outline: url
functions:
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.
params:
s string
func PathUnescape ¶
func PathUnescape(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
PathUnescape does the inverse transformation of PathEscape, 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. PathUnescape is identical to QueryUnescape except that it does not unescape '+' to ' ' (space).
outline: url
functions:
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).
params:
s string
func QueryEscape ¶
func QueryEscape(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
QueryEscape escapes the string so it can be safely placed inside a URL query.
outline: url
functions:
path_escape(s)
escapes the string so it can be safely placed inside a URL query.
params:
s string
func QueryUnescape ¶
func QueryUnescape(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
QueryUnescape does the inverse transformation of QueryEscape, 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.
outline: url
functions:
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.
params:
s string
Types ¶
type URL ¶
type URL struct {
// contains filtered or unexported fields
}
URL represents a parsed URL (technically, a URI reference).
outline: url
types:
URL
Represents a parsed URL (technically, a URI reference).
fields:
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 '#'.