Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`python`.`urlpath`.`URLPath``

class documentation

`class URLPath: (source)`

View In Hierarchy

A representation of a URL.

Class Method | `fromBytes` | Make a `URLPath` from a `bytes`.
Class Method | `fromRequest` | Make a `URLPath` from a `twisted.web.http.Request`.
Class Method | `fromString` | Make a `URLPath` from a `str` or `unicode`.
Method | `__init__` | Undocumented
Method | `__repr__` | The `repr` of a `URLPath` is an eval-able expression which will construct a similar `URLPath`.
Method | `__str__` | The `str` of a `URLPath` is its URL text.
Method | `child` | Get the child 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 | `here` | Get the current directory of this `URLPath`.
Method | `parent` | Get the parent directory of this `URLPath`.
Method | `pathList` | Split this URL's path into its components.
Method | `sibling` | Get the sibling of the current `URLPath`. A sibling is a file which is in the same directory as the current file.
Instance Variable | `fragment` | The page fragment (the portion after # in the URL).
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 | `scheme` | The scheme of the URL (e.g. 'http').
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`.
Method | `_reconstitute` | Reconstitute this `URLPath` from all its given attributes.
Instance Variable | `_fragment` | Undocumented
Instance Variable | `_netloc` | Undocumented
Instance Variable | `_path` | Undocumented
Instance Variable | `_query` | Undocumented
Instance Variable | `_scheme` | Undocumented
Instance Variable | `_url` | Undocumented

@classmethod
def fromBytes(klass, url): (source)

Make a `URLPath` from a `bytes`.

Parameters
klass | Undocumented
url:`bytes` | A `bytes` representation of a URL.
Returns
`URLPath` | a new `URLPath` derived from the given `bytes`.
Present Since
15.4

@classmethod
def fromRequest(klass, request): (source)

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

Parameters
klass | Undocumented
request | A `twisted.web.http.Request` to make the `URLPath` from.
Returns
`URLPath` | a new `URLPath` derived from the given request.

@classmethod
def fromString(klass, url): (source)

Make a `URLPath` from a `str` or `unicode`.

Parameters
klass | Undocumented
url:`str` or `unicode`. | A `str` representation of a URL.
Returns
`URLPath` | a new `URLPath` derived from the given string.

def __init__(self, scheme=b'', netloc=b'localhost', path=b'', query=b'', fragment=b''): (source)

Undocumented

def __repr__(self): (source)

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

Returns
`str` | Undocumented

def __str__(self): (source)

The `str` of a `URLPath` is its URL text.

Returns
`str` | Undocumented

def child(self, path, keepQuery=False): (source)

Get the child of this `URLPath`.

Parameters
path:`bytes` | The path of the child.
keepQuery:`bool` | Whether to keep the query parameters on the returned `URLPath`.
Returns
a 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.

Parameters
st:`bytes` | A relative URL, to be interpreted relative to `self` as the base URL.
Returns
a new `URLPath`

def here(self, keepQuery=False): (source)

Get the current directory of this `URLPath`.

Parameters
keepQuery:`bool` | Whether to keep the query parameters on the returned `URLPath`.
Returns
a new `URLPath`

def parent(self, keepQuery=False): (source)

Get the parent directory of this `URLPath`.

Parameters
keepQuery:`bool` | Whether to keep the query parameters on the returned `URLPath`.
Returns
a new `URLPath`

def pathList(self, unquote=False, copy=True): (source)

Split this URL's path into its components.

Parameters
unquote | whether to remove %-encoding from the returned strings.
copy | (ignored, do not use)
Returns
`list` of `bytes` | The components of `self.path`

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.

Parameters
path:`bytes` | The path of the sibling.
keepQuery:`bool` | Whether to keep the query parameters on the returned `URLPath`.
Returns
a new `URLPath`

fragment: `bytes` = (source)

The page fragment (the portion after # in the URL).

netloc: `bytes` = (source)

The network location ("host").

path: `bytes` = (source)

The path on the network location.

query: `bytes` = (source)

The query argument (the portion after ? in the URL).

scheme: `bytes` = (source)

The scheme of the URL (e.g. 'http').

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

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

Parameters
urlInstance:`_URL` | the object to base this `URLPath` on.
Returns
a new `URLPath`

def _mod(self, newURL, keepQuery): (source)

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

Parameters
newURL:`URL` | a `URL` to derive a new `URLPath` from
keepQuery:`bool` | if `True`, preserve the query parameters from `self` on the new `URLPath`; if `False`, give the new `URLPath` no query parameters.
Returns
a new `URLPath`

def _reconstitute(self): (source)

Reconstitute this `URLPath` from all its given attributes.

_fragment = (source)

Undocumented

_netloc = (source)

Undocumented

_path = (source)

Undocumented

_query = (source)

Undocumented

_scheme = (source)

Undocumented

_url = (source)

Undocumented