Update terminal api

This commit is contained in:
ibuler
2017-10-31 11:34:20 +08:00
parent 30c4fc9514
commit 034f0a02b1
15 changed files with 67 additions and 87 deletions

View File

@@ -274,8 +274,10 @@ def content_md5(data):
返回值可以直接作为HTTP Content-Type头部的值
"""
m = hashlib.md5(to_bytes(data))
return to_string(base64.b64encode(m.digest()))
if isinstance(data, str):
data = hashlib.md5(data.encode('utf-8'))
value = base64.b64encode(data.digest())
return value.decode('utf-8')
_STRPTIME_LOCK = threading.Lock()
@@ -330,8 +332,6 @@ def encrypt_password(password):
return None
def capacity_convert(size, expect='auto', rate=1000):
"""
:param size: '100MB', '1G'