| Server IP : 123.56.80.60 / Your IP : 216.73.216.78 Web Server : Apache/2.4.54 (Win32) OpenSSL/1.1.1s PHP/7.4.33 mod_fcgid/2.3.10-dev System : Windows NT iZhx3sob14hnz7Z 10.0 build 14393 (Windows Server 2016) i586 User : SYSTEM ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/python/Lib/site-packages/aliyunsdkcore/ |
Upload File : |
import sys
from aliyunsdkcore.vendored import six
if six.PY2:
from base64 import encodestring as b64_encode_bytes
from base64 import decodestring as b64_decode_bytes
def ensure_bytes(s, encoding='utf-8', errors='strict'):
if isinstance(s, unicode):
return s.encode(encoding, errors)
if isinstance(s, str):
return s
raise ValueError("Expected str or unicode, received %s." % type(s))
def ensure_string(s, encoding='utf-8', errors='strict'):
if isinstance(s, unicode):
return s.encode(encoding, errors)
if isinstance(s, str):
return s
raise ValueError("Expected str or unicode, received %s." % type(s))
else:
from base64 import encodebytes as b64_encode_bytes
from base64 import decodebytes as b64_decode_bytes
def ensure_bytes(s, encoding='utf-8', errors='strict'):
if isinstance(s, str):
return bytes(s, encoding=encoding)
if isinstance(s, bytes):
return s
if isinstance(s, bytearray):
return bytes(s)
raise ValueError(
"Expected str or bytes or bytearray, received %s." %
type(s))
def ensure_string(s, encoding='utf-8', errors='strict'):
if isinstance(s, str):
return s
if isinstance(s, (bytes, bytearray)):
return str(s, encoding='utf-8')
raise ValueError(
"Expected str or bytes or bytearray, received %s." %
type(s))