def _percent_encode(self, request, encoding=None):
        encoding = encoding or sys.stdin.encoding or DEFAULT_ENCODING

        try:
            s = unicode(request, encoding)
        except __HOLE__:
            if not isinstance(request, unicode):
                # We accept int etc. types as well
                s = unicode(request)
            else:
                s = request

        res = urllib.quote(
            s.encode('utf8'),
            safe='~')
        return res
dataset/ETHPy150Open quixey/python-aliyun/aliyun/connection.py/Connection._percent_encode