mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-19 18:17:37 +03:00
scripts/test-sender: Support for valid gzip compression
This commit is contained in:
parent
fb83aae240
commit
7537a300c0
@ -3,6 +3,7 @@
|
||||
|
||||
import argparse
|
||||
import requests
|
||||
import zlib
|
||||
|
||||
upload_url = 'https://dev.eddn.edcd.io:4432/upload/'
|
||||
|
||||
@ -25,6 +26,11 @@ send_message:
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
if args.gzip:
|
||||
if args.gzip == 'good':
|
||||
msg = zlib.compress(msg.encode('utf-8'))
|
||||
s.headers['Content-Encoding'] = 'gzip'
|
||||
|
||||
r = s.post(upload_url, data=msg)
|
||||
|
||||
print(f'Response: {r!r}')
|
||||
@ -47,6 +53,12 @@ if __name__ == "__main__":
|
||||
help='Specify to form-encode the request body',
|
||||
)
|
||||
|
||||
__parser.add_argument(
|
||||
'--gzip',
|
||||
choices=('good'),
|
||||
help='Specify to gzip-compress the request body',
|
||||
)
|
||||
|
||||
__parser.add_argument(
|
||||
'messagefile',
|
||||
metavar='<input file name>',
|
||||
|
Loading…
x
Reference in New Issue
Block a user