diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-04-27 00:25:09 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-04-27 00:25:09 +0200 |
| commit | a0e583ee4eebe37db4011a99b65d0d60db324054 (patch) | |
| tree | 51845a417f2998719160f7815d3f1f4fe8e89f20 /check/app/server/api.py | |
| parent | 8e9214f5d4d2a725eecdb11368451d99168ae240 (diff) | |
api now fetches url
Diffstat (limited to 'check/app/server/api.py')
| -rw-r--r-- | check/app/server/api.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/check/app/server/api.py b/check/app/server/api.py index 3742b15..63de5b6 100644 --- a/check/app/server/api.py +++ b/check/app/server/api.py @@ -34,9 +34,9 @@ def match(): start = time.time() try: - threshold = int(request.args.get('threshold') or 6) - limit = int(request.args.get('limit') or 1) - add = str(request.args.get('add') or 'true') == 'true' + threshold = int(request.form.get('threshold') or 6) + limit = int(request.form.get('limit') or 1) + add = str(request.form.get('add') or 'true') == 'true' except: return jsonify({ 'success': False, @@ -61,7 +61,7 @@ def match(): im = Image.open(file.stream).convert('RGB') else: - url = request.args.get('url') + url = request.form.get('url') if not url: return jsonify({ 'success': False, @@ -88,7 +88,8 @@ def match(): if len(results) == 0: if add and url: - hash = sha256_stream(file) + # hash = sha256_stream(file) + hash = sha256_stream(io.BytesIO(raw)) add_phash(sha256=hash, phash=phash, ext=ext, url=url) match = False else: |
