Skip to content

Commit

Permalink
Merge pull request #9 from CybercentreCanada/hotfix/post_search
Browse files Browse the repository at this point in the history
Hotfix/post search
  • Loading branch information
cccs-sgaron authored Apr 23, 2021
2 parents d61feee + fb22c2d commit 1c92625
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions assemblyline_client/v4_client/module/search/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

from assemblyline_client.v4_client.common.utils import SEARCHABLE, ClientError, api_path
from assemblyline_client.v4_client.module.search.facet import Facet
from assemblyline_client.v4_client.module.search.fields import Fields
Expand Down Expand Up @@ -26,14 +28,12 @@ def _do_search(self, bucket, query, **kwargs):
if isinstance(filters, str):
filters = [filters]

filters = [('filters', fq) for fq in filters]
kwargs['filters'] = filters

kwargs = {k: v for k, v in kwargs.items() if v is not None and k != 'filters'}
kwargs = {k: v for k, v in kwargs.items() if v is not None}
kwargs['query'] = query
if filters is not None:
kwargs['params_tuples'] = filters
path = api_path('search', bucket, **kwargs)
return self._connection.get(path)
path = api_path('search', bucket)
return self._connection.post(path, data=json.dumps(kwargs))

def alert(self, query, filters=None, fl=None, offset=0, rows=25, sort=None, timeout=None):
"""\
Expand Down
2 changes: 1 addition & 1 deletion assemblyline_client/v4_client/module/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def delete(self, username, fav_type, name):
Throws a Client exception if the user does not exist.
"""
return self._connection.delete(api_path('user', 'favorites', username, fav_type), data=name)
return self._connection.delete(api_path('user', 'favorites', username, fav_type), json=name)

def update(self, username, favorites):
"""\
Expand Down
2 changes: 1 addition & 1 deletion test/test_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def test_constants(client):

def test_tos(client):
res = client.help.tos()
assert res is None
assert res is None or isinstance(res, str)
2 changes: 1 addition & 1 deletion test/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_add_service(datastore, client):

# Cleanup so the new service does not interfere with other tests
datastore.service_delta.delete('ResultSample')
datastore.service.delete_matching('name:ResultSample')
datastore.service.delete_by_query('name:ResultSample')
datastore.service.commit()
datastore.service_delta.commit()

Expand Down

0 comments on commit 1c92625

Please sign in to comment.