dsys / match

:crystal_ball: Scalable reverse image search built on Kubernetes and Elasticsearch
Other
1.25k stars 150 forks source link

403 Forbidden on add #11

Closed adamgamble closed 7 years ago

adamgamble commented 7 years ago

I can list fine, but when I try to add I get 403 forbidden. Any ideas? This is a stock setup from the readme. I've tried using 2 dockers linked, and a docker hitting my local elasticsearch and get the same response both times.

Request: POST http://0.0.0.0:8888/add url=https://static.vecteezy.com/system/resources/previews/000/099/131/original/christmas-plants-background-and-label-vector.jpg filepath=https://static.vecteezy.com/system/resources/previews/000/099/131/original/christmas-plants-background-and-label-vector.jpg Response: {"method": "", "status": "fail", "result": [], "error": ["HTTP Error 403: Forbidden"]}

Stack trace from python:

[2016-12-24 08:56:37,511] ERROR in app: Exception on /add [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/app/match/server.py", line 69, in add_handler
    ses.add_image(path, img, bytestream=bs, metadata=metadata)
  File "/usr/local/lib/python3.5/site-packages/image_match/signature_database_base.py", line 202, in add_image
    rec = make_record(path, self.gis, self.k, self.N, img=img, bytestream=bytestream, metadata=metadata)
  File "/usr/local/lib/python3.5/site-packages/image_match/signature_database_base.py", line 339, in make_record
    signature = gis.generate_signature(img, bytestream=bytestream)
  File "/usr/local/lib/python3.5/site-packages/image_match/goldberg.py", line 151, in generate_signature
    im_array = self.preprocess_image(path_or_image, handle_mpo=self.handle_mpo, bytestream=bytestream)
  File "/usr/local/lib/python3.5/site-packages/image_match/goldberg.py", line 226, in preprocess_image
    return imread(image_or_path, as_grey=True)
  File "/usr/local/lib/python3.5/site-packages/skimage/io/_io.py", line 60, in imread
    with file_or_url_context(fname) as fname:
  File "/usr/local/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.5/site-packages/skimage/io/util.py", line 29, in file_or_url_context
    u = urlopen(resource_name)
  File "/usr/local/lib/python3.5/urllib/request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.5/urllib/request.py", line 472, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.5/urllib/request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/local/lib/python3.5/urllib/request.py", line 510, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.5/urllib/request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
adamgamble commented 7 years ago

Nevermind, it was cloudflare blocking the image.