GLib.Uri¶
Fields¶
None
Methods¶
| class | build(flags, scheme, userinfo, host, port, path, query, fragment) | 
| class | build_with_user(flags, scheme, user, password, auth_params, host, port, path, query, fragment) | 
| class | error_quark() | 
| class | escape_bytes(unescaped, reserved_chars_allowed) | 
| class | escape_string(unescaped, reserved_chars_allowed, allow_utf8) | 
| class | is_valid(uri_string, flags) | 
| class | join(flags, scheme, userinfo, host, port, path, query, fragment) | 
| class | join_with_user(flags, scheme, user, password, auth_params, host, port, path, query, fragment) | 
| class | list_extract_uris(uri_list) | 
| class | parse(uri_string, flags) | 
| class | parse_params(params, length, separators, flags) | 
| class | parse_scheme(uri) | 
| class | peek_scheme(uri) | 
| class | resolve_relative(base_uri_string, uri_ref, flags) | 
| class | split(uri_ref, flags) | 
| class | split_network(uri_string, flags) | 
| class | split_with_user(uri_ref, flags) | 
| class | unescape_bytes(escaped_string, length, illegal_characters) | 
| class | unescape_segment(escaped_string, escaped_string_end, illegal_characters) | 
| class | unescape_string(escaped_string, illegal_characters) | 
| get_auth_params() | |
| get_flags() | |
| get_fragment() | |
| get_host() | |
| get_password() | |
| get_path() | |
| get_port() | |
| get_query() | |
| get_scheme() | |
| get_user() | |
| get_userinfo() | |
| parse_relative(uri_ref, flags) | |
| to_string() | |
| to_string_partial(flags) | 
Details¶
- 
class GLib.Uri¶
- The - GLib.Uritype and related functions can be used to parse URIs into their components, and build valid URIs from individual components.- Note that - GLib.Uriscope is to help manipulate URIs in various applications, following RFC 3986. In particular, it doesn’t intend to cover web browser needs, and doesn’t implement the WHATWG URL standard. No APIs are provided to help prevent homograph attacks, so- GLib.Uriis not suitable for formatting URIs for display to the user for making security-sensitive decisions.- Relative and absolute URIs
 - As defined in RFC 3986, the hierarchical nature of URIs means that they can either be ‘relative references’ (sometimes referred to as ‘relative URIs’) or ‘URIs’ (for clarity, ‘URIs’ are referred to in this documentation as ‘absolute URIs’ — although in constrast to RFC 3986, fragment identifiers are always allowed). - Relative references have one or more components of the URI missing. In particular, they have no scheme. Any other component, such as hostname, query, etc. may be missing, apart from a path, which has to be specified (but may be empty). The path may be relative, starting with - ./rather than- /.- For example, a valid relative reference is - ./path?query,- /?query#fragmentor- //example.com.- Absolute URIs have a scheme specified. Any other components of the URI which are missing are specified as explicitly unset in the URI, rather than being resolved relative to a base URI using - GLib.Uri.parse_relative().- For example, a valid absolute URI is - file:///home/bobor- https://search.com?query=string.- A - GLib.Uriinstance is always an absolute URI. A string may be an absolute URI or a relative reference; see the documentation for individual functions as to what forms they accept.- Parsing URIs
 - The most minimalist APIs for parsing URIs are - GLib.Uri.split() and- GLib.Uri.split_with_user(). These split a URI into its component parts, and return the parts; the difference between the two is that- GLib.Uri.split() treats the ‘userinfo’ component of the URI as a single element, while- GLib.Uri.split_with_user() can (depending on the- GLib.UriFlagsyou pass) treat it as containing a username, password, and authentication parameters. Alternatively,- GLib.Uri.split_network() can be used when you are only interested in the components that are needed to initiate a network connection to the service (scheme, host, and port).- GLib.Uri.parse() is similar to- GLib.Uri.split(), but instead of returning individual strings, it returns a- GLib.Uristructure (and it requires that the URI be an absolute URI).- GLib.Uri.resolve_relative() and- GLib.Uri.parse_relative() allow you to resolve a relative URI relative to a base URI.- GLib.Uri.resolve_relative() takes two strings and returns a string, and- GLib.Uri.parse_relative() takes a- GLib.Uriand a string and returns a- GLib.Uri.- All of the parsing functions take a - GLib.UriFlagsargument describing exactly how to parse the URI; see the documentation for that type for more details on the specific flags that you can pass. If you need to choose different flags based on the type of URI, you can use- GLib.Uri.peek_scheme() on the URI string to check the scheme first, and use that to decide what flags to parse it with.- For example, you might want to use - GLib.UriParamsFlags.WWW_FORMwhen parsing the params for a web URI, so compare the result of- GLib.Uri.peek_scheme() against- httpand- https.- Building URIs
 - GLib.Uri.join() and- GLib.Uri.join_with_user() can be used to construct valid URI strings from a set of component strings. They are the inverse of- GLib.Uri.split() and- GLib.Uri.split_with_user().- Similarly, - GLib.Uri.build() and- GLib.Uri.build_with_user() can be used to construct a- GLib.Urifrom a set of component strings.- As with the parsing functions, the building functions take a - GLib.UriFlagsargument. In particular, it is important to keep in mind whether the URI components you are using are already- %-encoded. If so, you must pass the- GLib.UriFlags.ENCODEDflag.- file:// URIs
 - Note that Windows and Unix both define special rules for parsing - file://URIs (involving non-UTF-8 character sets on Unix, and the interpretation of path separators on Windows).- GLib.Uridoes not implement these rules. Use- GLib.filename_from_uri() and- GLib.filename_to_uri() if you want to properly convert between- file://URIs and local filenames.- URI Equality
 - Note that there is no - g_uri_equal ()function, because comparing URIs usefully requires scheme-specific knowledge that- GLib.Uridoes not have. For example,- http://example.com/and- http://EXAMPLE.COM:80have exactly the same meaning according to the HTTP specification, and- data:,fooand- data:;base64,Zm9vresolve to the same thing according to the- data:URI specification.- New in version 2.66. - 
classmethod build(flags, scheme, userinfo, host, port, path, query, fragment)[source]¶
- Parameters: - flags (GLib.UriFlags) – flags describing how to build theGLib.Uri
- scheme (str) – the URI scheme
- userinfo (strorNone) – the userinfo component, orNone
- host (strorNone) – the host component, orNone
- port (int) – the port, or-1
- path (str) – the path component
- query (strorNone) – the query component, orNone
- fragment (strorNone) – the fragment, orNone
 - Returns: - a new - GLib.Uri- Return type: - Creates a new - GLib.Urifrom the given components according to flags.- See also - GLib.Uri.build_with_user(), which allows specifying the components of the “userinfo” separately.- New in version 2.66. 
- flags (
 - 
classmethod build_with_user(flags, scheme, user, password, auth_params, host, port, path, query, fragment)[source]¶
- Parameters: - flags (GLib.UriFlags) – flags describing how to build theGLib.Uri
- scheme (str) – the URI scheme
- user (strorNone) – the user component of the userinfo, orNone
- password (strorNone) – the password component of the userinfo, orNone
- auth_params (strorNone) – the auth params of the userinfo, orNone
- host (strorNone) – the host component, orNone
- port (int) – the port, or-1
- path (str) – the path component
- query (strorNone) – the query component, orNone
- fragment (strorNone) – the fragment, orNone
 - Returns: - a new - GLib.Uri- Return type: - Creates a new - GLib.Urifrom the given components according to flags (- GLib.UriFlags.HAS_PASSWORDis added unconditionally). The flags must be coherent with the passed values, in particular use- %-encoded values with- GLib.UriFlags.ENCODED.- In contrast to - GLib.Uri.build(), this allows specifying the components of the ‘userinfo’ field separately. Note that user must be non-- Noneif either password or auth_params is non-- None.- New in version 2.66. 
- flags (
 - 
classmethod escape_bytes(unescaped, reserved_chars_allowed)[source]¶
- Parameters: - Returns: - an escaped version of unescaped. The returned string should be freed when no longer needed. - Return type: - Escapes arbitrary data for use in a URI. - Normally all characters that are not ‘unreserved’ (i.e. ASCII alphanumerical characters plus dash, dot, underscore and tilde) are escaped. But if you specify characters in reserved_chars_allowed they are not escaped. This is useful for the ‘reserved’ characters in the URI specification, since those are allowed unescaped in some portions of a URI. - Though technically incorrect, this will also allow escaping nul bytes as `%` - 00.- New in version 2.66. 
 - 
classmethod escape_string(unescaped, reserved_chars_allowed, allow_utf8)[source]¶
- Parameters: - Returns: - an escaped version of unescaped. The returned string should be freed when no longer needed. - Return type: - Escapes a string for use in a URI. - Normally all characters that are not “unreserved” (i.e. ASCII alphanumerical characters plus dash, dot, underscore and tilde) are escaped. But if you specify characters in reserved_chars_allowed they are not escaped. This is useful for the “reserved” characters in the URI specification, since those are allowed unescaped in some portions of a URI. - New in version 2.16. 
 - 
classmethod is_valid(uri_string, flags)[source]¶
- Parameters: - uri_string (str) – a string containing an absolute URI
- flags (GLib.UriFlags) – flags for parsing uri_string
 - Raises: - Returns: - Return type: - Parses uri_string according to flags, to determine whether it is a valid ‘absolute URI [relative-absolute-uris]’, i.e. it does not need to be resolved relative to another URI using - GLib.Uri.parse_relative().- If it’s not a valid URI, an error is returned explaining how it’s invalid. - See - GLib.Uri.split(), and the definition of- GLib.UriFlags, for more information on the effect of flags.- New in version 2.66. 
- uri_string (
 - 
classmethod join(flags, scheme, userinfo, host, port, path, query, fragment)[source]¶
- Parameters: - flags (GLib.UriFlags) – flags describing how to build the URI string
- scheme (strorNone) – the URI scheme, orNone
- userinfo (strorNone) – the userinfo component, orNone
- host (strorNone) – the host component, orNone
- port (int) – the port, or-1
- path (str) – the path component
- query (strorNone) – the query component, orNone
- fragment (strorNone) – the fragment, orNone
 - Returns: - an absolute URI string - Return type: - Joins the given components together according to flags to create an absolute URI string. path may not be - None(though it may be the empty string).- When host is present, path must either be empty or begin with a slash ( - /) character. When host is not present, path cannot begin with two slash characters (- //). See RFC 3986, section 3.- See also - GLib.Uri.join_with_user(), which allows specifying the components of the ‘userinfo’ separately.- GLib.UriFlags.HAS_PASSWORDand- GLib.UriFlags.HAS_AUTH_PARAMSare ignored if set in flags.- New in version 2.66. 
- flags (
 - 
classmethod join_with_user(flags, scheme, user, password, auth_params, host, port, path, query, fragment)[source]¶
- Parameters: - flags (GLib.UriFlags) – flags describing how to build the URI string
- scheme (strorNone) – the URI scheme, orNone
- user (strorNone) – the user component of the userinfo, orNone
- password (strorNone) – the password component of the userinfo, orNone
- auth_params (strorNone) – the auth params of the userinfo, orNone
- host (strorNone) – the host component, orNone
- port (int) – the port, or-1
- path (str) – the path component
- query (strorNone) – the query component, orNone
- fragment (strorNone) – the fragment, orNone
 - Returns: - an absolute URI string - Return type: - Joins the given components together according to flags to create an absolute URI string. path may not be - None(though it may be the empty string).- In contrast to - GLib.Uri.join(), this allows specifying the components of the ‘userinfo’ separately. It otherwise behaves the same.- GLib.UriFlags.HAS_PASSWORDand- GLib.UriFlags.HAS_AUTH_PARAMSare ignored if set in flags.- New in version 2.66. 
- flags (
 - 
classmethod list_extract_uris(uri_list)[source]¶
- Parameters: - uri_list ( - str) – an URI list- Returns: - a newly allocated - None-terminated list of strings holding the individual URIs. The array should be freed with- GLib.strfreev().- Return type: - [ - str]- Splits an URI list conforming to the text/uri-list mime type defined in RFC 2483 into individual URIs, discarding any comments. The URIs are not validated. - New in version 2.6. 
 - 
classmethod parse(uri_string, flags)[source]¶
- Parameters: - uri_string (str) – a string representing an absolute URI
- flags (GLib.UriFlags) – flags describing how to parse uri_string
 - Raises: - Returns: - a new - GLib.Uri.- Return type: - Parses uri_string according to flags. If the result is not a valid ‘absolute URI [relative-absolute-uris]’, it will be discarded, and an error returned. - New in version 2.66. 
- uri_string (
 - 
classmethod parse_params(params, length, separators, flags)[source]¶
- Parameters: - params (str) – a%-encoded string containingattribute=valueparameters
- length (int) – the length of params, or-1if it is nul-terminated
- separators (str) – the separator byte character set between parameters. (usually&, but sometimes;or both&;). Note that this function works on bytes not characters, so it can’t be used to delimit UTF-8 strings for anything but ASCII characters. You may pass an empty set, in which case no splitting will occur.
- flags (GLib.UriParamsFlags) – flags to modify the way the parameters are handled.
 - Raises: - Returns: - A hash table of attribute/value pairs, with both names and values fully-decoded; or - Noneon error.- Return type: - Many URI schemes include one or more attribute/value pairs as part of the URI value. This method can be used to parse them into a hash table. When an attribute has multiple occurrences, the last value is the final returned value. If you need to handle repeated attributes differently, use - GLib.UriParamsIter.- The params string is assumed to still be - %-encoded, but the returned values will be fully decoded. (Thus it is possible that the returned values may contain- =or separators, if the value was encoded in the input.) Invalid- %-encoding is treated as with the- GLib.UriFlags.PARSE_RELAXEDrules for- GLib.Uri.parse(). (However, if params is the path or query string from a- GLib.Urithat was parsed without- GLib.UriFlags.PARSE_RELAXEDand- GLib.UriFlags.ENCODED, then you already know that it does not contain any invalid encoding.)- GLib.UriParamsFlags.WWW_FORMis handled as documented for- GLib.UriParamsIter.init().- If - GLib.UriParamsFlags.CASE_INSENSITIVEis passed to flags, attributes will be compared case-insensitively, so a params string- attr=123&Attr=456will only return a single attribute–value pair,- Attr=456. Case will be preserved in the returned attributes.- If params cannot be parsed (for example, it contains two separators characters in a row), then error is set and - Noneis returned.- New in version 2.66. 
- params (
 - 
classmethod parse_scheme(uri)[source]¶
- Parameters: - uri ( - str) – a valid URI.- Returns: - The ‘scheme’ component of the URI, or - Noneon error. The returned string should be freed when no longer needed.- Return type: - stror- None- Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as: - URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]- Common schemes include - file,- https,- svn+ssh, etc.- New in version 2.16. 
 - 
classmethod peek_scheme(uri)[source]¶
- Parameters: - uri ( - str) – a valid URI.- Returns: - The ‘scheme’ component of the URI, or - Noneon error. The returned string is normalized to all-lowercase, and interned via- GLib.intern_string(), so it does not need to be freed.- Return type: - stror- None- Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as: - URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]- Common schemes include - file,- https,- svn+ssh, etc.- Unlike - GLib.Uri.parse_scheme(), the returned scheme is normalized to all-lowercase and does not need to be freed.- New in version 2.66. 
 - 
classmethod resolve_relative(base_uri_string, uri_ref, flags)[source]¶
- Parameters: - base_uri_string (strorNone) – a string representing a base URI
- uri_ref (str) – a string representing a relative or absolute URI
- flags (GLib.UriFlags) – flags describing how to parse uri_ref
 - Raises: - Returns: - the resolved URI string. - Return type: - Parses uri_ref according to flags and, if it is a ‘relative URI [relative-absolute-uris]’, resolves it relative to base_uri_string. If the result is not a valid absolute URI, it will be discarded, and an error returned. - (If base_uri_string is - None, this just returns uri_ref, or- Noneif uri_ref is invalid or not absolute.)- New in version 2.66. 
- base_uri_string (
 - 
classmethod split(uri_ref, flags)[source]¶
- Parameters: - uri_ref (str) – a string containing a relative or absolute URI
- flags (GLib.UriFlags) – flags for parsing uri_ref
 - Raises: - Returns: - Trueif uri_ref parsed successfully,- Falseon error.- scheme: - on return, contains the scheme (converted to lowercase), or - None- userinfo: - on return, contains the userinfo, or - None- host: - on return, contains the host, or - None- port: - on return, contains the port, or - -1- path: - on return, contains the path - query: - on return, contains the query, or - None- fragment: - on return, contains the fragment, or - None- Return type: - ( - bool, scheme:- stror- None, userinfo:- stror- None, host:- stror- None, port:- int, path:- str, query:- stror- None, fragment:- stror- None)- Parses uri_ref (which can be an ‘absolute or relative URI [relative-absolute-uris]’) according to flags, and returns the pieces. Any component that doesn’t appear in uri_ref will be returned as - None(but note that all URIs always have a path component, though it may be the empty string).- If flags contains - GLib.UriFlags.ENCODED, then- %-encoded characters in uri_ref will remain encoded in the output strings. (If not, then all such characters will be decoded.) Note that decoding will only work if the URI components are ASCII or UTF-8, so you will need to use- GLib.UriFlags.ENCODEDif they are not.- Note that the - GLib.UriFlags.HAS_PASSWORDand- GLib.UriFlags.HAS_AUTH_PARAMSflags are ignored by- GLib.Uri.split(), since it always returns only the full userinfo; use- GLib.Uri.split_with_user() if you want it split up.- New in version 2.66. 
- uri_ref (
 - 
classmethod split_network(uri_string, flags)[source]¶
- Parameters: - uri_string (str) – a string containing an absolute URI
- flags (GLib.UriFlags) – flags for parsing uri_string
 - Raises: - Returns: - Trueif uri_string parsed successfully,- Falseon error.- scheme: - on return, contains the scheme (converted to lowercase), or - None- host: - on return, contains the host, or - None- port: - on return, contains the port, or - -1- Return type: - Parses uri_string (which must be an ‘absolute URI [relative-absolute-uris]’) according to flags, and returns the pieces relevant to connecting to a host. See the documentation for - GLib.Uri.split() for more details; this is mostly a wrapper around that function with simpler arguments. However, it will return an error if uri_string is a relative URI, or does not contain a hostname component.- New in version 2.66. 
- uri_string (
 - 
classmethod split_with_user(uri_ref, flags)[source]¶
- Parameters: - uri_ref (str) – a string containing a relative or absolute URI
- flags (GLib.UriFlags) – flags for parsing uri_ref
 - Raises: - Returns: - Trueif uri_ref parsed successfully,- Falseon error.- scheme: - on return, contains the scheme (converted to lowercase), or - None- user: - on return, contains the user, or - None- password: - on return, contains the password, or - None- auth_params: - on return, contains the auth_params, or - None- host: - on return, contains the host, or - None- port: - on return, contains the port, or - -1- path: - on return, contains the path - query: - on return, contains the query, or - None- fragment: - on return, contains the fragment, or - None- Return type: - ( - bool, scheme:- stror- None, user:- stror- None, password:- stror- None, auth_params:- stror- None, host:- stror- None, port:- int, path:- str, query:- stror- None, fragment:- stror- None)- Parses uri_ref (which can be an ‘absolute or relative URI [relative-absolute-uris]’) according to flags, and returns the pieces. Any component that doesn’t appear in uri_ref will be returned as - None(but note that all URIs always have a path component, though it may be the empty string).- See - GLib.Uri.split(), and the definition of- GLib.UriFlags, for more information on the effect of flags. Note that password will only be parsed out if flags contains- GLib.UriFlags.HAS_PASSWORD, and auth_params will only be parsed out if flags contains- GLib.UriFlags.HAS_AUTH_PARAMS.- New in version 2.66. 
- uri_ref (
 - 
classmethod unescape_bytes(escaped_string, length, illegal_characters)[source]¶
- Parameters: - Raises: - Returns: - an unescaped version of escaped_string or - Noneon error (if decoding failed, using- GLib.UriError.FAILEDerror code). The returned- GLib.Bytesshould be unreffed when no longer needed.- Return type: - Unescapes a segment of an escaped string as binary data. - Note that in contrast to - GLib.Uri.unescape_string(), this does allow nul bytes to appear in the output.- If any of the characters in illegal_characters appears as an escaped character in escaped_string, then that is an error and - Nonewill be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.- New in version 2.66. 
 - 
classmethod unescape_segment(escaped_string, escaped_string_end, illegal_characters)[source]¶
- Parameters: - Returns: - an unescaped version of escaped_string or - Noneon error. The returned string should be freed when no longer needed. As a special case if- Noneis given for escaped_string, this function will return- None.- Return type: - Unescapes a segment of an escaped string. - If any of the characters in illegal_characters or the NUL character appears as an escaped character in escaped_string, then that is an error and - Nonewill be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.- Note: - NULbyte is not accepted in the output, in contrast to- GLib.Uri.unescape_bytes().- New in version 2.16. 
 - 
classmethod unescape_string(escaped_string, illegal_characters)[source]¶
- Parameters: - Returns: - an unescaped version of escaped_string. The returned string should be freed when no longer needed. - Return type: - Unescapes a whole escaped string. - If any of the characters in illegal_characters or the NUL character appears as an escaped character in escaped_string, then that is an error and - Nonewill be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.- New in version 2.16. 
 - 
get_auth_params()[source]¶
- Returns: - self’s authentication parameters. - Return type: - stror- None- Gets self’s authentication parameters, which may contain - %-encoding, depending on the flags with which self was created. (If self was not created with- GLib.UriFlags.HAS_AUTH_PARAMSthen this will be- None.)- Depending on the URI scheme, - GLib.Uri.parse_params() may be useful for further parsing this information.- New in version 2.66. 
 - 
get_flags()[source]¶
- Returns: - self’s flags. - Return type: - GLib.UriFlags- Gets self’s flags set upon construction. - New in version 2.66. 
 - 
get_fragment()[source]¶
- Returns: - self’s fragment. - Return type: - stror- None- Gets self’s fragment, which may contain - %-encoding, depending on the flags with which self was created.- New in version 2.66. 
 - 
get_host()[source]¶
- Returns: - self’s host. - Return type: - str- Gets self’s host. This will never have - %-encoded characters, unless it is non-UTF-8 (which can only be the case if self was created with- GLib.UriFlags.NON_DNS).- If self contained an IPv6 address literal, this value will be just that address, without the brackets around it that are necessary in the string form of the URI. Note that in this case there may also be a scope ID attached to the address. Eg, `fe80::1234%` - em1(or `fe80::1234%`- 25em1if the string is still encoded).- New in version 2.66. 
 - 
get_password()[source]¶
- Returns: - self’s password. - Return type: - stror- None- Gets self’s password, which may contain - %-encoding, depending on the flags with which self was created. (If self was not created with- GLib.UriFlags.HAS_PASSWORDthen this will be- None.)- New in version 2.66. 
 - 
get_path()[source]¶
- Returns: - self’s path. - Return type: - str- Gets self’s path, which may contain - %-encoding, depending on the flags with which self was created.- New in version 2.66. 
 - 
get_port()[source]¶
- Returns: - self’s port, or - -1if no port was specified.- Return type: - int- Gets self’s port. - New in version 2.66. 
 - 
get_query()[source]¶
- Returns: - self’s query. - Return type: - stror- None- Gets self’s query, which may contain - %-encoding, depending on the flags with which self was created.- For queries consisting of a series of - name=valueparameters,- GLib.UriParamsIteror- GLib.Uri.parse_params() may be useful.- New in version 2.66. 
 - 
get_scheme()[source]¶
- Returns: - self’s scheme. - Return type: - str- Gets self’s scheme. Note that this will always be all-lowercase, regardless of the string or strings that self was created from. - New in version 2.66. 
 - 
get_user()[source]¶
- Returns: - self’s user. - Return type: - stror- None- Gets the ‘username’ component of self’s userinfo, which may contain - %-encoding, depending on the flags with which self was created. If self was not created with- GLib.UriFlags.HAS_PASSWORDor- GLib.UriFlags.HAS_AUTH_PARAMS, this is the same as- GLib.Uri.get_userinfo().- New in version 2.66. 
 - 
get_userinfo()[source]¶
- Returns: - self’s userinfo. - Return type: - stror- None- Gets self’s userinfo, which may contain - %-encoding, depending on the flags with which self was created.- New in version 2.66. 
 - 
parse_relative(uri_ref, flags)[source]¶
- Parameters: - uri_ref (str) – a string representing a relative or absolute URI
- flags (GLib.UriFlags) – flags describing how to parse uri_ref
 - Raises: - Returns: - a new - GLib.Uri.- Return type: - Parses uri_ref according to flags and, if it is a ‘relative URI [relative-absolute-uris]’, resolves it relative to self. If the result is not a valid absolute URI, it will be discarded, and an error returned. - New in version 2.66. 
- uri_ref (
 - 
to_string()[source]¶
- Returns: - a string representing self, which the caller must free. - Return type: - str- Returns a string representing self. - This is not guaranteed to return a string which is identical to the string that self was parsed from. However, if the source URI was syntactically correct (according to RFC 3986), and it was parsed with - GLib.UriFlags.ENCODED, then- GLib.Uri.to_string() is guaranteed to return a string which is at least semantically equivalent to the source URI (according to RFC 3986).- If self might contain sensitive details, such as authentication parameters, or private data in its query string, and the returned string is going to be logged, then consider using - GLib.Uri.to_string_partial() to redact parts.- New in version 2.66. 
 - 
to_string_partial(flags)[source]¶
- Parameters: - flags ( - GLib.UriHideFlags) – flags describing what parts of self to hide- Returns: - a string representing self, which the caller must free. - Return type: - str- Returns a string representing self, subject to the options in flags. See - GLib.Uri.to_string() and- GLib.UriHideFlagsfor more details.- New in version 2.66.