Python pip._vendor.idna.IDNAError() Examples

The following are 30 code examples of pip._vendor.idna.IDNAError(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pip._vendor.idna , or try the search function .
Example #1
Source File: url.py    From rules_pip with MIT License 6 votes vote down vote up
def _idna_encode(name):
    if name and any([ord(x) > 128 for x in name]):
        try:
            from pip._vendor import idna
        except ImportError:
            six.raise_from(
                LocationParseError("Unable to parse URL without the 'idna' module"),
                None,
            )
        try:
            return idna.encode(name.lower(), strict=True, std3_rules=True)
        except idna.IDNAError:
            six.raise_from(
                LocationParseError(u"Name '%s' is not a valid IDNA label" % name), None
            )
    return name.lower().encode("ascii") 
Example #2
Source File: url.py    From pex with Apache License 2.0 6 votes vote down vote up
def _idna_encode(name):
    if name and any([ord(x) > 128 for x in name]):
        try:
            from pip._vendor import idna
        except ImportError:
            six.raise_from(
                LocationParseError("Unable to parse URL without the 'idna' module"),
                None,
            )
        try:
            return idna.encode(name.lower(), strict=True, std3_rules=True)
        except idna.IDNAError:
            six.raise_from(
                LocationParseError(u"Name '%s' is not a valid IDNA label" % name), None
            )
    return name.lower().encode("ascii") 
Example #3
Source File: url.py    From CogAlg with MIT License 6 votes vote down vote up
def _idna_encode(name):
    if name and any([ord(x) > 128 for x in name]):
        try:
            from pip._vendor import idna
        except ImportError:
            six.raise_from(
                LocationParseError("Unable to parse URL without the 'idna' module"),
                None,
            )
        try:
            return idna.encode(name.lower(), strict=True, std3_rules=True)
        except idna.IDNAError:
            six.raise_from(
                LocationParseError(u"Name '%s' is not a valid IDNA label" % name), None
            )
    return name.lower().encode("ascii") 
Example #4
Source File: models.py    From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #5
Source File: models.py    From Weapon-Detection-And-Classification with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #6
Source File: models.py    From rules_pip with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #7
Source File: models.py    From guildai with Apache License 2.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #8
Source File: models.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #9
Source File: models.py    From CogAlg with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #10
Source File: models.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #11
Source File: models.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #12
Source File: models.py    From android_universal with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #13
Source File: models.py    From fxxkpython with GNU General Public License v3.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #14
Source File: models.py    From fxxkpython with GNU General Public License v3.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #15
Source File: models.py    From fxxkpython with GNU General Public License v3.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #16
Source File: models.py    From fxxkpython with GNU General Public License v3.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #17
Source File: models.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #18
Source File: models.py    From hacktoberfest2018 with GNU General Public License v3.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #19
Source File: models.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #20
Source File: models.py    From FuYiSpider with Apache License 2.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #21
Source File: models.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #22
Source File: models.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #23
Source File: models.py    From pex with Apache License 2.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #24
Source File: models.py    From deepWordBug with Apache License 2.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #25
Source File: models.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #26
Source File: models.py    From Python24 with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #27
Source File: models.py    From hacktoberfest2018 with GNU General Public License v3.0 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #28
Source File: models.py    From pySINDy with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #29
Source File: models.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host 
Example #30
Source File: models.py    From Building-Recommendation-Systems-with-Python with MIT License 5 votes vote down vote up
def _get_idna_encoded_host(host):
        from pip._vendor import idna

        try:
            host = idna.encode(host, uts46=True).decode('utf-8')
        except idna.IDNAError:
            raise UnicodeError
        return host