Athanasius 6799a7fae9 scripts/testing: Target dev:4432, not beta:4431
In the long-term these all need to support a CL arg to select the
target.
2022-01-11 15:36:53 +00:00

39 lines
820 B
Python

#!/usr/bin/env python3
#
# 2022-01-10: THIS SCRIPT DOES NOT PERFORM THE INTENDED PURPOSE
# BECAUSE IT SEEMS THAT `requests` (or underlying modules) IS TOO CLEVER
# AND APPLIES COMPRESSION WHEN WE SET THE `Content-Encoding: gzip`
# HEADER
import json
import requests
import sys
print('''
DO NOT USE THIS SCRIPT, IT DOES NOT PERFORM THE INTENDED PURPOSE.
USE THE `test-bad-gzip.sh` SCRIPT INSTEAD.
''')
sys.exit(-1)
if len(sys.argv) != 2:
print('test-sender.py <filename>')
sys.exit(-1)
with open(sys.argv[1], 'r') as f:
msg = f.read()
s = requests.Session()
# This apparently causes compression to actually happen
s.headers['Content-Encoding'] = 'gzip'
r = s.post(
'https://dev.eddn.edcd.io:4432/upload/',
data=msg,
)
print(f'Response: {r!r}')
print(f'Body: {r.content.decode()}')