TorSpider / TorSpider-Backend

The database backend with which the spiders share their discoveries.
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Error with PATCH request through API #20

Closed haxys closed 6 years ago

haxys commented 6 years ago
2018-03-01 18:13:57,089 - werkzeug - INFO - 192.168.1.61 - - [01/Mar/2018 18:13:57] "PATCH /api/pages HTTP/1.0" 500 -
2018-03-01 18:13:57,440 - app - ERROR - Exception on /api/pages [PATCH]
Traceback (most recent call last):
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask_restless/views.py", line 157, in decorator
    return func(*args, **kw)
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/mimerender.py", line 244, in wrapper
    result = target(*args, **kwargs)
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask/views.py", line 149, in dispatch_request
    return meth(*args, **kwargs)
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask_restless/views.py", line 189, in wrapped
    return func(*args, **kw)
  File "/home/chris/TorSpider/backend/venv/lib/python3.5/site-packages/flask_restless/views.py", line 1499, in patch
    content_is_json = content_type.startswith('application/json')
AttributeError: 'NoneType' object has no attribute 'startswith'
haxys commented 6 years ago

From the spider:

2018-03-01 19:15:30,460 - INFO - Maryann: Ready to explore!
2018-03-01 19:15:30,470 - DEBUG - Maryann: Running GET Query on endpoint: next
2018-03-01 19:15:30,752 - DEBUG - Maryann: GET Query successful for endpoint: next
2018-03-01 19:15:30,762 - DEBUG - Maryann: Found next url: 7cbqhjnlkivmigxf.onion
2018-03-01 19:15:30,770 - DEBUG - Maryann: Updating onion: 7cbqhjnlkivmigxf.onion data: {"scan_date": "2018-03-01", "last_node": "c9e623b4c69d4b1e"}
2018-03-01 19:15:30,983 - DEBUG - Maryann: Update failed: 7cbqhjnlkivmigxf.onion
2018-03-01 19:15:30,989 - DEBUG - Maryann: Getting head of url: http://7cbqhjnlkivmigxf.onion/
haxys commented 6 years ago

I wiped everything and started with a fresh database and fresh installation, both frontend and backend, and can't reproduce this error.

artagel commented 6 years ago

AttributeError: 'NoneType' object has no attribute 'startswith' indicates that you weren't sending any headers or able to see the headers in flask, so it evaluated against headers of "None". Odd.