URLSpec
from panda3d.core import URLSpec
- class URLSpec
Bases:
DTOOL_SUPER_BASE
A container for a URL, e.g. “http://server:port/path”.
The URLSpec object is similar to a Filename in that it contains logic to identify the various parts of a URL and return (or modify) them separately.
Inheritance diagram
- __init__(*args, **kwargs)
- assign()
C++ Interface: assign(const URLSpec self, str url)
- authority
- compareTo()
C++ Interface: compare_to(URLSpec self, const URLSpec other)
- /**
Returns a number less than zero if this URLSpec sorts before the other one,
greater than zero if it sorts after, or zero if they are equivalent.
*/
- compare_to()
C++ Interface: compare_to(URLSpec self, const URLSpec other)
- /**
Returns a number less than zero if this URLSpec sorts before the other one,
greater than zero if it sorts after, or zero if they are equivalent.
*/
- empty()
C++ Interface: empty(URLSpec self)
- /**
Returns false if the URLSpec is valid (not empty), or true if it is an
empty string.
*/
- getAuthority()
C++ Interface: get_authority(URLSpec self)
- /**
Returns the authority specified by the URL (this includes username, server,
and/or port), or empty string if no authority is specified.
*/
- getDefaultPortForScheme()
C++ Interface: get_default_port_for_scheme(str scheme)
- /**
Returns the default port number for the indicated scheme, or 0 if there is
no known default.
*/
- getPath()
C++ Interface: get_path(URLSpec self)
- /**
Returns the path specified by the URL, or “/” if no path is specified.
*/
- getPathAndQuery()
C++ Interface: get_path_and_query(URLSpec self)
- /**
Returns the path (or “/” if no path is specified), followed by the query if
it is specified.
*/
- getPort()
C++ Interface: get_port(URLSpec self)
- /**
Returns the port number specified by the URL, or the default port if not
specified.
*/
- getPortStr()
C++ Interface: get_port_str(URLSpec self)
- /**
Returns the port specified by the URL as a string, or the empty string if
no port is specified. Compare this with get_port(), which returns a
default port number if no port is specified.
*/
- getQuery()
C++ Interface: get_query(URLSpec self)
- /**
Returns the query specified by the URL, or empty string if no query is
specified.
*/
- getScheme()
C++ Interface: get_scheme(URLSpec self)
- /**
Returns the scheme specified by the URL, or empty string if no scheme is
specified.
*/
- getServer()
C++ Interface: get_server(URLSpec self)
- /**
Returns the server name specified by the URL, if any. In case of an IPv6
address, does not include the enclosing brackets.
*/
- getServerAndPort()
C++ Interface: get_server_and_port(URLSpec self)
- /**
Returns a string consisting of the server name, followed by a colon,
followed by the port number. If the port number is not explicitly given in
the URL, this string will include the implicit port number.
If the server is an IPv6 address, it will be enclosed in square brackets.
*/
- getUsername()
C++ Interface: get_username(URLSpec self)
- /**
Returns the username specified by the URL, if any. This might also include
a password, e.g. “username:password”, although putting a password on the
URL is probably a bad idea.
*/
- get_authority()
C++ Interface: get_authority(URLSpec self)
- /**
Returns the authority specified by the URL (this includes username, server,
and/or port), or empty string if no authority is specified.
*/
- get_default_port_for_scheme()
C++ Interface: get_default_port_for_scheme(str scheme)
- /**
Returns the default port number for the indicated scheme, or 0 if there is
no known default.
*/
- get_path()
C++ Interface: get_path(URLSpec self)
- /**
Returns the path specified by the URL, or “/” if no path is specified.
*/
- get_path_and_query()
C++ Interface: get_path_and_query(URLSpec self)
- /**
Returns the path (or “/” if no path is specified), followed by the query if
it is specified.
*/
- get_port()
C++ Interface: get_port(URLSpec self)
- /**
Returns the port number specified by the URL, or the default port if not
specified.
*/
- get_port_str()
C++ Interface: get_port_str(URLSpec self)
- /**
Returns the port specified by the URL as a string, or the empty string if
no port is specified. Compare this with get_port(), which returns a
default port number if no port is specified.
*/
- get_query()
C++ Interface: get_query(URLSpec self)
- /**
Returns the query specified by the URL, or empty string if no query is
specified.
*/
- get_scheme()
C++ Interface: get_scheme(URLSpec self)
- /**
Returns the scheme specified by the URL, or empty string if no scheme is
specified.
*/
- get_server()
C++ Interface: get_server(URLSpec self)
- /**
Returns the server name specified by the URL, if any. In case of an IPv6
address, does not include the enclosing brackets.
*/
- get_server_and_port()
C++ Interface: get_server_and_port(URLSpec self)
- /**
Returns a string consisting of the server name, followed by a colon,
followed by the port number. If the port number is not explicitly given in
the URL, this string will include the implicit port number.
If the server is an IPv6 address, it will be enclosed in square brackets.
*/
- get_username()
C++ Interface: get_username(URLSpec self)
- /**
Returns the username specified by the URL, if any. This might also include
a password, e.g. “username:password”, although putting a password on the
URL is probably a bad idea.
*/
- hasAuthority()
C++ Interface: has_authority(URLSpec self)
- /**
Returns true if the URL specifies an authority (this includes username,
server, and/or port), false otherwise.
*/
- hasPath()
C++ Interface: has_path(URLSpec self)
- /**
Returns true if the URL includes a path specification (that is, the
particular filename on the server to retrieve), false otherwise.
*/
- hasPort()
C++ Interface: has_port(URLSpec self)
- /**
Returns true if the URL specifies a port number, false otherwise.
*/
- hasQuery()
C++ Interface: has_query(URLSpec self)
- /**
Returns true if the URL includes a query specification, false otherwise.
*/
- hasScheme()
C++ Interface: has_scheme(URLSpec self)
- /**
Returns true if the URL specifies a scheme (e.g. “http:”), false
otherwise.
*/
- hasServer()
C++ Interface: has_server(URLSpec self)
- /**
Returns true if the URL specifies a server name, false otherwise.
*/
- hasUsername()
C++ Interface: has_username(URLSpec self)
- /**
Returns true if the URL specifies a username (and/or password), false
otherwise.
*/
- has_authority()
C++ Interface: has_authority(URLSpec self)
- /**
Returns true if the URL specifies an authority (this includes username,
server, and/or port), false otherwise.
*/
- has_path()
C++ Interface: has_path(URLSpec self)
- /**
Returns true if the URL includes a path specification (that is, the
particular filename on the server to retrieve), false otherwise.
*/
- has_port()
C++ Interface: has_port(URLSpec self)
- /**
Returns true if the URL specifies a port number, false otherwise.
*/
- has_query()
C++ Interface: has_query(URLSpec self)
- /**
Returns true if the URL includes a query specification, false otherwise.
*/
- has_scheme()
C++ Interface: has_scheme(URLSpec self)
- /**
Returns true if the URL specifies a scheme (e.g. “http:”), false
otherwise.
*/
- has_server()
C++ Interface: has_server(URLSpec self)
- /**
Returns true if the URL specifies a server name, false otherwise.
*/
- has_username()
C++ Interface: has_username(URLSpec self)
- /**
Returns true if the URL specifies a username (and/or password), false
otherwise.
*/
- isDefaultPort()
C++ Interface: is_default_port(URLSpec self)
- /**
Returns true if the port number encoded in this URL is the default port
number for the scheme (or if there is no port number), or false if it is a
nonstandard port.
*/
- isSsl()
C++ Interface: is_ssl(URLSpec self)
- /**
Returns true if the URL’s scheme specifies an SSL-secured protocol such as
https, or false otherwise.
*/
- is_default_port()
C++ Interface: is_default_port(URLSpec self)
- /**
Returns true if the port number encoded in this URL is the default port
number for the scheme (or if there is no port number), or false if it is a
nonstandard port.
*/
- is_ssl()
C++ Interface: is_ssl(URLSpec self)
- /**
Returns true if the URL’s scheme specifies an SSL-secured protocol such as
https, or false otherwise.
*/
- path
- port
- query
- quote()
C++ Interface: quote(str source, str safe)
- /**
Returns the source string with all “unsafe” characters quoted, making a
string suitable for placing in a URL. Letters, digits, and the underscore,
comma, period, and hyphen characters, as well as any included in the safe
string, are left alone; all others are converted to hex representation.
*/
- quotePlus()
C++ Interface: quote_plus(str source, str safe)
- /**
Behaves like quote() with the additional behavior of replacing spaces with
plus signs.
*/
- quote_plus()
C++ Interface: quote_plus(str source, str safe)
- /**
Behaves like quote() with the additional behavior of replacing spaces with
plus signs.
*/
- scheme
- server
- server_and_port
- setAuthority()
C++ Interface: set_authority(const URLSpec self, str authority)
- /**
Replaces the authority part of the URL specification. This includes the
username, server, and port.
*/
- setPath()
C++ Interface: set_path(const URLSpec self, str path)
- /**
Replaces the path part of the URL specification.
*/
- setPort()
C++ Interface: set_port(const URLSpec self, str port) set_port(const URLSpec self, int port)
- setQuery()
C++ Interface: set_query(const URLSpec self, str query)
- /**
Replaces the query part of the URL specification.
*/
- setScheme()
C++ Interface: set_scheme(const URLSpec self, str scheme)
- /**
Replaces the scheme part of the URL specification.
*/
- setServer()
C++ Interface: set_server(const URLSpec self, str server)
- /**
Replaces the server part of the URL specification.
Unlike set_server_and_port, this method does not require IPv6 addresses to
be enclosed in square brackets.
*/
- setServerAndPort()
C++ Interface: set_server_and_port(const URLSpec self, str server_and_port)
- /**
Replaces the server and port parts of the URL specification simultaneously.
The input string should be of the form “server:port”, or just “server” to
make the port number implicit.
Any IPv6 address must be enclosed in square brackets.
*/
- setUrl()
C++ Interface: set_url(const URLSpec self, str url, bool server_name_expected)
- /**
Completely replaces the URL with the indicated string. If
server_name_expected is true, it is a hint that an undecorated URL is
probably a server name, not a local filename.
*/
- setUsername()
C++ Interface: set_username(const URLSpec self, str username)
- /**
Replaces the username part of the URL specification.
*/
- set_authority()
C++ Interface: set_authority(const URLSpec self, str authority)
- /**
Replaces the authority part of the URL specification. This includes the
username, server, and port.
*/
- set_path()
C++ Interface: set_path(const URLSpec self, str path)
- /**
Replaces the path part of the URL specification.
*/
- set_port()
C++ Interface: set_port(const URLSpec self, str port) set_port(const URLSpec self, int port)
- set_query()
C++ Interface: set_query(const URLSpec self, str query)
- /**
Replaces the query part of the URL specification.
*/
- set_scheme()
C++ Interface: set_scheme(const URLSpec self, str scheme)
- /**
Replaces the scheme part of the URL specification.
*/
- set_server()
C++ Interface: set_server(const URLSpec self, str server)
- /**
Replaces the server part of the URL specification.
Unlike set_server_and_port, this method does not require IPv6 addresses to
be enclosed in square brackets.
*/
- set_server_and_port()
C++ Interface: set_server_and_port(const URLSpec self, str server_and_port)
- /**
Replaces the server and port parts of the URL specification simultaneously.
The input string should be of the form “server:port”, or just “server” to
make the port number implicit.
Any IPv6 address must be enclosed in square brackets.
*/
- set_url()
C++ Interface: set_url(const URLSpec self, str url, bool server_name_expected)
- /**
Completely replaces the URL with the indicated string. If
server_name_expected is true, it is a hint that an undecorated URL is
probably a server name, not a local filename.
*/
- set_username()
C++ Interface: set_username(const URLSpec self, str username)
- /**
Replaces the username part of the URL specification.
*/
- ssl
- unquote()
C++ Interface: unquote(str source)
- /**
Reverses the operation of quote(): converts escaped characters of the form
“%xx” to their ascii equivalent.
*/
- unquotePlus()
C++ Interface: unquote_plus(str source)
- /**
Reverses the operation of quote_plus(): converts escaped characters of the
form “%xx” to their ascii equivalent, and also converts plus signs to
spaces.
*/
- unquote_plus()
C++ Interface: unquote_plus(str source)
- /**
Reverses the operation of quote_plus(): converts escaped characters of the
form “%xx” to their ascii equivalent, and also converts plus signs to
spaces.
*/
- username