コード例 #1
0
def compress(passwords):
    buf = BytesIO()
    gzip_data = gzip.GzipFile(fileobj=buf, mode='wb')
    data = json.dumps(passwords)
    gzip_data.write(data.encode('utf-8'))
    gzip_data.close()
    return buf.getvalue()
コード例 #2
0
ファイル: utils.py プロジェクト: norsig/yith-library-server
def compress(passwords):
    buf = BytesIO()
    gzip_data = gzip.GzipFile(fileobj=buf, mode='wb')
    renderer = json_renderer(None)
    data = renderer(passwords, {})
    gzip_data.write(data.encode('utf-8'))
    gzip_data.close()
    return buf.getvalue()
コード例 #3
0
ファイル: utils.py プロジェクト: ablanco/yith-library-server
def compress(passwords):
    buf = BytesIO()
    gzip_data = gzip.GzipFile(fileobj=buf, mode='wb')
    renderer = json_renderer(None)
    data = renderer(passwords, {})
    gzip_data.write(data.encode('utf-8'))
    gzip_data.close()
    return buf.getvalue()
コード例 #4
0
def get_gzip_data(text):
    buf = BytesIO()
    gzip_data = gzip.GzipFile(fileobj=buf, mode='wb')
    gzip_data.write(text.encode('utf-8'))
    gzip_data.close()
    return buf.getvalue()
コード例 #5
0
def get_gzip_data(text):
    buf = BytesIO()
    gzip_data = gzip.GzipFile(fileobj=buf, mode='wb')
    gzip_data.write(text.encode('utf-8'))
    gzip_data.close()
    return buf.getvalue()