aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-10-26 17:57:26 -0700
committerBryan Newbold <bnewbold@archive.org>2021-10-26 17:57:28 -0700
commit85a264afa2b0cb844d56ccdccc0b8f6bf16f7621 (patch)
tree9a21e2d1d1ee752edb42aca2ef96e6a7bb83f50a
parenta39e4b864968fa73e475cc40af67203faef5236d (diff)
downloadsandcrawler-85a264afa2b0cb844d56ccdccc0b8f6bf16f7621.tar.gz
sandcrawler-85a264afa2b0cb844d56ccdccc0b8f6bf16f7621.zip
ingest file HTTP API: fixes from type checking
This code is deprecated and should be removed anyways, but still interesting to see the fixes
-rw-r--r--python/sandcrawler/ingest_file.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/sandcrawler/ingest_file.py b/python/sandcrawler/ingest_file.py
index 9faf98b..b3f2a8e 100644
--- a/python/sandcrawler/ingest_file.py
+++ b/python/sandcrawler/ingest_file.py
@@ -826,11 +826,11 @@ class IngestFileWorker(SandcrawlerWorker):
class IngestFileRequestHandler(BaseHTTPRequestHandler):
- def do_POST(self):
+ def do_POST(self) -> None:
if self.path != "/ingest":
self.send_response(404)
self.end_headers()
- self.wfile.write("404: Not Found")
+ self.wfile.write(b"404: Not Found")
return
length = int(self.headers.get('content-length'))
request = json.loads(self.rfile.read(length).decode('utf-8'))
@@ -839,4 +839,4 @@ class IngestFileRequestHandler(BaseHTTPRequestHandler):
result = ingester.process(request)
self.send_response(200)
self.end_headers()
- self.wfile.write(json.dumps(result))
+ self.wfile.write(json.dumps(result).encode('utf8'))