1.39Class URI

Interface to RFC3986 Universal Resource Indicator.

Class URI( [path],[decode] )
path The URI that will be used as initial data.
decode True if the path is URI encoded, and must be decoded (default).
Raise
ParamError in case the inital URI is malformed.

This class offers an object oriented interface to access URI elements.

Setting the properties in this class immediately reflects on the related fields; for example setting the value of the uri property causes a complete re-parse of the item; setting a field as the query string will cause the uri to change.

Each update is subject to RFC3986 compliance checks, and will raise a ParseError if conformance of the URI object is broken.

Properties
fragment Fragment string in the uri (following path and query after a '#').
host Host specificator.
path Path specificator.
port Optional port specificator (following the host after a ':').
query Query string in the URI.
scheme URI scheme.
uri Complete URI.
userInfo User, password or account specification preceding '@' host.
Methods
decodeDecode a string to from URL encoding (static).
encodeEncode a string to URL encoding (static).
getFieldsReturns fields contained in the query element into a dictionary.
setFieldsSets query fields for this uri.
toStringReturns a string representing this URI.

Properties

fragment

Fragment string in the uri (following path and query after a '#').

Fragment string in the uri (following path and query after a '#').

host

Host specificator.

Host specificator.

path

Path specificator.

Path specificator.

port

Optional port specificator (following the host after a ':').

Optional port specificator (following the host after a ':').

query

Query string in the URI.

Query string in the URI.

scheme

URI scheme.

URI scheme.

uri

Complete URI.

Complete URI.

userInfo

User, password or account specification preceding '@' host.

User, password or account specification preceding '@' host.

Methods

decode

Decode a string to from URL encoding (static).

URI.decode( enc_string )
enc_string The URI/URL encoded string.
ReturnThe decoded string.
Raise
ParamError if the string is not a valid URI/URL encoded string.

encode

Encode a string to URL encoding (static).

URI.encode( string )
string The string to be encoded.
Returnthe URL/URI encoded string.

getFields

Returns fields contained in the query element into a dictionary.

URI.getFields()
ReturnThe fields as a dictionary of nil if the query part contains no element.
Raise
ParamError if the string is not a valid URI/URL encoded string.

setFields

Sets query fields for this uri.

URI.setFields( fields )
fields A dictionary of fields or nil to clear the query.
Raise
ParamError if the input dictionary contains non-string values.

toString

Returns a string representing this URI.

URI.toString()
ReturnAn URI encoded string containing a valid URI.

Renders the URI into a valid string representation.

See also: URI.

Made with http://www.falconpl.org