def origin(self):
        """Return an URL with scheme, host and port parts only.

        user, password, path, query and fragment are removed.

        """
        # TODO: add a keyword-only option for keeping user/pass maybe?
        if not self.is_absolute():
            raise ValueError("URL should be absolute")
        if not self._val.scheme:
            raise ValueError("URL should have scheme")
        v = self._val
        netloc = self._make_netloc(None, None, v.hostname, v.port, encode=False)
        val = v._replace(netloc=netloc, path="", query="", fragment="")
        return URL(val, encoded=True)
Return an URL with scheme, host and port parts only.

        user, password, path, query and fragment are removed.