def __v4_uri_encode()

in oss2/auth.py [0:0]


    def __v4_uri_encode(self, raw_text, ignoreSlashes):
        raw_text = to_bytes(raw_text)

        res = ''
        for b in raw_text:
            if isinstance(b, int):
                c = chr(b)
            else:
                c = b

            if (c >= 'A' and c <= 'Z') or (c >= 'a' and c <= 'z')\
                or (c >= '0' and c <= '9') or c in ['_', '-', '~', '.']:
                res += c
            elif ignoreSlashes is True and  c == '/':
                res += c
            else:
                res += "%{0:02X}".format(ord(c))

        return res