revert: no chunk transfer
This commit is contained in:
parent
f40f57925a
commit
f2cf016fc5
2 changed files with 9 additions and 15 deletions
|
|
@ -34,7 +34,7 @@ def bitmap():
|
|||
payload = 'P5\n296 152\n255\n'
|
||||
payload += ''.join([chr(i) for i in bitmap_data])
|
||||
print(payload)
|
||||
req = requests.put('http://host.docker.internal:8080/api/tag', data=chunk_gen(bitmap_data), headers={
|
||||
req = requests.put('http://localhost:8080/api/tag', data=payload, headers={
|
||||
'Content-Type': 'image/x-portable-greymap'
|
||||
})
|
||||
return jsonify({'payload': payload, 'code': req.status_code})
|
||||
|
|
@ -43,16 +43,5 @@ def bitmap():
|
|||
except Exception as e:
|
||||
return jsonify({"error": e}), 500
|
||||
|
||||
|
||||
def chunk_gen(bitmap_data):
|
||||
header = f'P5\n296 152\n255\n'
|
||||
yield header.encode('latin-1')
|
||||
|
||||
chunk_size = 1024
|
||||
for i in range(0, len(bitmap_data), chunk_size):
|
||||
chunk = bitmap_data[i:i + chunk_size]
|
||||
yield bytes(chunk)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run('0.0.0.0', port=80)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,14 @@ services:
|
|||
container_name: backend_service
|
||||
ports:
|
||||
- "12001:80"
|
||||
# bitmap_service:
|
||||
# build: ./bitmap_service
|
||||
# container_name: bitmap_service
|
||||
# ports:
|
||||
# - "12002:80"
|
||||
bitmap_service:
|
||||
build: ./bitmap_service
|
||||
container_name: bitmap_service
|
||||
build: ./trash
|
||||
container_name: trash
|
||||
ports:
|
||||
- "12002:80"
|
||||
extra_hosts:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue