How to use the hyperlink.DecodedURL function in hyperlink

To help you get started, we’ve selected a few hyperlink examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twisted / klein / src / klein / _request.py View on Github external
from ._interfaces import IHTTPHeaders, IHTTPRequest
from ._message import MessageState, bodyAsBytes, bodyAsFount, validateBody


__all__ = ()


@implementer(IHTTPRequest)  # type: ignore[misc]
@attrs(frozen=True)
class FrozenHTTPRequest(object):
    """
    Immutable HTTP request.
    """

    method = attrib(validator=instance_of(Text))  # type: Text
    uri = attrib(validator=instance_of(DecodedURL))  # type: DecodedURL
    headers = attrib(
        validator=provides(IHTTPHeaders)  # type: ignore[misc]
    )  # type: IHTTPHeaders

    _body = attrib(validator=validateBody)  # type: Union[bytes, IFount]

    _state = attrib(
        default=Factory(MessageState), init=False
    )  # type: MessageState

    def bodyAsFount(self):
        # type: () -> IFount
        return bodyAsFount(self._body, self._state)

    def bodyAsBytes(self):
        # type: () -> Deferred[bytes]
github twisted / klein / loginspike.py View on Github external
from klein.interfaces import (
    ISimpleAccountBinding, SessionMechanism, ISimpleAccount, ISessionProcurer,
    ISessionStore, ISession
)

from klein.storage.sql import (
    procurerFromDataStore, authorizerFor, SessionSchema, DataStore, Transaction
)

from twisted.web.util import Redirect

if TYPE_CHECKING:
    from hyperlink import DecodedURL
    # silence flake8 for type-checking
    (ISessionProcurer, Deferred, IRequest, Dict, Tag, Any, RenderableForm,
     ISessionStore, DecodedURL)

app = Klein()

def bootstrap(x):
    # type: (str) -> str
    return "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/" + x

requirer = Requirer()

style = Plating(
    tags=tags.html(
        tags.head(
            tags.link(rel="stylesheet",
                      href=bootstrap("css/bootstrap.min.css"),
                      crossorigin="anonymous"),
            # tags.script(

hyperlink

A featureful, immutable, and correct URL for Python.

MIT
Latest version published 4 years ago

Package Health Score

76 / 100
Full package analysis