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()
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()
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()