class documentation

class twisted.python.urlpath.URLPath: (source)

View In Hierarchy

A representation of a URL.

Instance Variable scheme The scheme of the URL (e.g. 'http').
Instance Variable netloc The network location ("host").
Instance Variable path The path on the network location.
Instance Variable query The query argument (the portion after ? in the URL).
Instance Variable fragment The page fragment (the portion after # in the URL).
Method __init__ Undocumented
Method pathList Split this URL's path into its components.
Class Method fromString Make a URLPath from a str or unicode.
Class Method fromBytes Make a URLPath from a bytes.
Class Method fromRequest Make a URLPath from a twisted.web.http.Request.
Method sibling Get the sibling of the current URLPath. A sibling is a file which is in the same directory as the current file.
Method child Get the child of this URLPath.
Method parent Get the parent directory of this URLPath.
Method here Get the current directory of this URLPath.
Method click Return a path which is the URL where a browser would presumably take you if you clicked on a link with an HREF as given.
Method __str__ The str of a URLPath is its URL text.
Method __repr__ The repr of a URLPath is an eval-able expression which will construct a similar URLPath.
Instance Variable _scheme Undocumented
Instance Variable _netloc Undocumented
Instance Variable _path Undocumented
Instance Variable _query Undocumented
Instance Variable _fragment Undocumented
Method _reconstitute Reconstitute this URLPath from all its given attributes.
Instance Variable _url Undocumented
Class Method _fromURL Reconstruct all the public instance variables of this URLPath from its underlying _URL.
Method _mod Return a modified copy of self using newURL, keeping the query string if keepQuery is True.
scheme = (source)
The scheme of the URL (e.g. 'http').
(type: bytes)
netloc = (source)
The network location ("host").
(type: bytes)
path = (source)
The path on the network location.
(type: bytes)
query = (source)
The query argument (the portion after ? in the URL).
(type: bytes)
fragment = (source)
The page fragment (the portion after # in the URL).
(type: bytes)
def __init__(self, scheme=b'', netloc=b'localhost', path=b'', query=b'', fragment=b''): (source)

Undocumented

_scheme = (source)

Undocumented

_netloc = (source)

Undocumented

_path = (source)

Undocumented

_query = (source)

Undocumented

_fragment = (source)

Undocumented

def _reconstitute(self): (source)

Reconstitute this URLPath from all its given attributes.

_url = (source)

Undocumented

@classmethod
def _fromURL(cls, urlInstance): (source)

Reconstruct all the public instance variables of this URLPath from its underlying _URL.

ParametersurlInstancethe object to base this URLPath on. (type: _URL)
Returnsa new URLPath
def pathList(self, unquote=False, copy=True): (source)

Split this URL's path into its components.

Parametersunquotewhether to remove %-encoding from the returned strings.
copy(ignored, do not use)
ReturnsThe components of self.path (type: list of bytes)
@classmethod
def fromString(klass, url): (source)

Make a URLPath from a str or unicode.

ParametersklassUndocumented
urlA str representation of a URL. (type: str or unicode.)
Returnsa new URLPath derived from the given string. (type: URLPath)
@classmethod
def fromBytes(klass, url): (source)

Make a URLPath from a bytes.

ParametersklassUndocumented
urlA bytes representation of a URL. (type: bytes)
Returnsa new URLPath derived from the given bytes. (type: URLPath)
Present Since15.4
@classmethod
def fromRequest(klass, request): (source)

Make a URLPath from a twisted.web.http.Request.

ParametersklassUndocumented
requestA twisted.web.http.Request to make the URLPath from.
Returnsa new URLPath derived from the given request. (type: URLPath)
def _mod(self, newURL, keepQuery): (source)

Return a modified copy of self using newURL, keeping the query string if keepQuery is True.

ParametersnewURLa URL to derive a new URLPath from (type: URL)
keepQueryif True, preserve the query parameters from self on the new URLPath; if False, give the new URLPath no query parameters. (type: bool)
Returnsa new URLPath
def sibling(self, path, keepQuery=False): (source)

Get the sibling of the current URLPath. A sibling is a file which is in the same directory as the current file.

ParameterspathThe path of the sibling. (type: bytes)
keepQueryWhether to keep the query parameters on the returned URLPath. (type: bool)
Returnsa new URLPath
def child(self, path, keepQuery=False): (source)

Get the child of this URLPath.

ParameterspathThe path of the child. (type: bytes)
keepQueryWhether to keep the query parameters on the returned URLPath. (type: bool)
Returnsa new URLPath
def parent(self, keepQuery=False): (source)

Get the parent directory of this URLPath.

ParameterskeepQueryWhether to keep the query parameters on the returned URLPath. (type: bool)
Returnsa new URLPath
def here(self, keepQuery=False): (source)

Get the current directory of this URLPath.

ParameterskeepQueryWhether to keep the query parameters on the returned URLPath. (type: bool)
Returnsa new URLPath
def click(self, st): (source)

Return a path which is the URL where a browser would presumably take you if you clicked on a link with an HREF as given.

ParametersstA relative URL, to be interpreted relative to self as the base URL. (type: bytes)
Returnsa new URLPath
def __str__(self): (source)

The str of a URLPath is its URL text.

ReturnsUndocumented (type: str)
def __repr__(self): (source)

The repr of a URLPath is an eval-able expression which will construct a similar URLPath.

ReturnsUndocumented (type: str)
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.