How to use the hyperlink.URL.fromText 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 ebu / ebu-tt-live-toolkit / ebu_tt_live / twisted / websocket.py View on Github external
def _parse_path(self, full_url):
        if not isinstance(full_url, six.text_type):
            full_url = six.text_type(full_url)
        result = URL.fromText(full_url).to_iri()
        sequence_identifier, action = result.path
        return sequence_identifier, action
github burningmantech / ranger-ims-server / src / ims / config / _urls.py View on Github external
viewIncidents: ClassVar = viewEvent.child("incidents").child("")
    viewIncidentsTemplate: ClassVar = app.child("incidents.html")
    viewIncidentsJS: ClassVar = static.child("incidents.js")
    viewIncidentsRelative: ClassVar = URL.fromText("incidents").child("")

    viewIncidentNumber: ClassVar = viewIncidents.child("")
    viewIncidentTemplate: ClassVar = app.child("incident.html")
    viewIncidentJS: ClassVar = static.child("incident.js")

    viewIncidentReports: ClassVar = (
        viewEvent.child("incident_reports").child("")
    )
    viewIncidentReportsTemplate: ClassVar = app.child("incident_reports.html")
    viewIncidentReportsJS: ClassVar = static.child("incident_reports.js")
    viewIncidentReportsRelative: ClassVar = (
        URL.fromText("incident_reports").child("")
    )

    viewIncidentReportNew: ClassVar = viewIncidentReports.child("new")
    viewIncidentReportNumber: ClassVar = viewIncidentReports.child("")
    viewIncidentReportTemplate: ClassVar = app.child("incident_report.html")
    viewIncidentReportJS: ClassVar = static.child("incident_report.js")
github burningmantech / ranger-ims-server / src / ims / application / _external.py View on Github external
lscacheVersion = f"lscache-{lscacheVersionNumber}"

    bootstrapSourceURL = URL.fromText(
        f"https://github.com/twbs/bootstrap/releases/download/"
        f"v{bootstrapVersionNumber}/{bootstrapVersion}.zip"
    )

    jqueryJSSourceURL = URL.fromText(
        f"https://code.jquery.com/{jqueryVersion}.min.js"
    )

    jqueryMapSourceURL = URL.fromText(
        f"https://code.jquery.com/{jqueryVersion}.min.map"
    )

    dataTablesSourceURL = URL.fromText(
        f"https://datatables.net/releases/"
        f"DataTables-{dataTablesVersionNumber}.zip"
    )

    momentJSSourceURL = URL.fromText(
        f"https://cdnjs.cloudflare.com/ajax/libs/moment.js/"
        f"{momentVersionNumber}/moment.min.js"
    )

    lscacheJSSourceURL = URL.fromText(
        f"https://raw.githubusercontent.com/pamelafox/lscache/"
        f"{lscacheVersionNumber}/lscache.min.js"
    )

    @router.route(
        _unprefix(URLs.bootstrapBase), methods=("HEAD", "GET"), branch=True
github burningmantech / ranger-ims-server / src / ims / config / _urls.py View on Github external
from hyperlink import URL


__all__ = ()


@attrs(frozen=True, auto_attribs=True, kw_only=True)
class URLs(object):
    """
    Incident Management System URL schema.
    """

    # Main application

    root: ClassVar = URL.fromText("/")

    prefix: ClassVar = root.child("ims").child("")
    urlsJS: ClassVar = prefix.child("urls.js")

    # Static resources
    static: ClassVar = prefix.child("static")
    styleSheet: ClassVar = static.child("style.css")
    logo: ClassVar = static.child("logo.png")

    # Auth application

    auth: ClassVar = prefix.child("auth").child("")
    login: ClassVar = auth.child("login")
    logout: ClassVar = auth.child("logout")

    # External application
github burningmantech / ranger-ims-server / src / ims / application / _external.py View on Github external
config: Configuration

    bootstrapVersionNumber = "3.3.7"
    jqueryVersionNumber = "3.1.0"
    dataTablesVersionNumber = "1.10.12"
    momentVersionNumber = "2.22.2"
    lscacheVersionNumber = "1.0.5"

    bootstrapVersion = f"bootstrap-{bootstrapVersionNumber}-dist"
    jqueryVersion = f"jquery-{jqueryVersionNumber}"
    dataTablesVersion = f"DataTables-{dataTablesVersionNumber}"
    momentVersion = f"moment-{momentVersionNumber}"
    lscacheVersion = f"lscache-{lscacheVersionNumber}"

    bootstrapSourceURL = URL.fromText(
        f"https://github.com/twbs/bootstrap/releases/download/"
        f"v{bootstrapVersionNumber}/{bootstrapVersion}.zip"
    )

    jqueryJSSourceURL = URL.fromText(
        f"https://code.jquery.com/{jqueryVersion}.min.js"
    )

    jqueryMapSourceURL = URL.fromText(
        f"https://code.jquery.com/{jqueryVersion}.min.map"
    )

    dataTablesSourceURL = URL.fromText(
        f"https://datatables.net/releases/"
        f"DataTables-{dataTablesVersionNumber}.zip"
    )
github twisted / twisted / src / twisted / python / urlpath.py View on Github external
Make a L{URLPath} from a L{str} or L{unicode}.

        @param url: A L{str} representation of a URL.
        @type url: L{str} or L{unicode}.

        @return: a new L{URLPath} derived from the given string.
        @rtype: L{URLPath}
        """
        if not isinstance(url, (str, unicode)):
            raise ValueError("'url' must be a str or unicode")
        if isinstance(url, bytes):
            # On Python 2, accepting 'str' (for compatibility) means we might
            # get 'bytes'.  On py3, this will not work with bytes due to the
            # check above.
            return klass.fromBytes(url)
        return klass._fromURL(_URL.fromText(url))
github LeastAuthority / leastauthority.com / src / lae_automation / opstools.py View on Github external
def _reinvite_server2(reactor, subscription_id):
    provisioner = None
    subscription_id = subscription_id.decode("utf-8")
    subscription_manager_client = network_client(
        b"http://subscription-manager/",
        Agent(reactor),
    )
    details = yield subscription_manager_client.get(subscription_id)
    from lae_automation.signup import get_wormhole_signup
    from wormhole import wormhole
    from hyperlink import URL
    from twisted.python.filepath import FilePath
    from tempfile import mktemp
    results_path = FilePath(mktemp())
    rendezvous_url = URL.fromText(u"ws://wormhole:4000/v1")
    signup = get_wormhole_signup(
        reactor,
        provisioner,
        wormhole,
        rendezvous_url,
        results_path,
    )
    wormhole_claim = yield signup._details_to_wormhole_code(details)
    print("invite-code: {}".format(wormhole_claim.code))
    # Make sure it appears in the log.
    stdout.flush()
    while not (results_path.exists() and results_path.getsize()):
        yield deferLater(reactor, 30.0, lambda: None)
github burningmantech / ranger-ims-server / src / ims / application / _external.py View on Github external
async def dataTablesResource(self, request: IRequest) -> KleinRenderable:
        """
        Endpoint for DataTables.
        """
        requestURL = URL.fromText(request.uri.decode("ascii"))

        # Remove URL prefix
        names = requestURL.path[len(URLs.dataTablesBase.path) - 1 :]

        request.setHeader(HeaderName.contentType.value, ContentType.css.value)
        return await self.cachedZippedResource(
            request,
            self.dataTablesSourceURL,
            self.dataTablesVersion,
            self.dataTablesVersion,
            *names,
        )

hyperlink

A featureful, immutable, and correct URL for Python.

MIT
Latest version published 4 years ago

Package Health Score

76 / 100
Full package analysis