@classmethod
    def from_url(cls, url, show_host=True):
        # url must be idna-encoded and url-quotted
        url = urlparse(url)
        query = sum([[(k.decode('utf-8', errors="replace"),
                       v.decode('utf-8', errors="replace"))
                      for v in values]
                     for k, values in parse_qs(url.query).items()], [])
        host = url.netloc.split(':', 1)[0] if ':' in url.netloc else url.netloc
        if isinstance(host, unicode):
            host = host.encode('idna')

        port = url.netloc.split(':')[1] if ':' in url.netloc else ''
        path = urllib.unquote(url.path)
        if isinstance(url.path, str):
            path = path.decode('utf-8')

        return cls(path,
                   query, host.decode('idna'),
                   port, url.scheme, show_host)
Sign and create a token that can be used for things such as resetting
dataset/ETHPy150Open SmartTeleMax/iktomi/iktomi/web/url.py/URL.from_url--crossover with--dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/catwatch/blueprints/user/models.py/User.serialize_token