Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. def gzipped_json_response(obj):
  2. obj_as_bytes = bytes(json.dumps(obj), 'utf-8')
  3. out = gzip.compress(obj_as_bytes, compresslevel=5)
  4. return aiohttp.web.Response(
  5. body=out,
  6. headers={
  7. "Content-Encoding":"gzip"
  8. }
  9. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement