Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to pass in params to search function #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ns1/rest/zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ def retrieve(self, zone, callback=None, errback=None):
pagination_handler=zone_retrieve_pagination,
)

def search(self, zone, q=None, has_geo=False, callback=None, errback=None):
params = {}
def search(self, zone, q=None, has_geo=False, callback=None, errback=None, params={}):
if q is not None:
params["q"] = q
if has_geo:
Expand Down
4 changes: 2 additions & 2 deletions ns1/zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def success(result, *args):
self.zone, callback=success, errback=errback
)

def search(self, q=None, has_geo=False, callback=None, errback=None):
def search(self, q=None, has_geo=False, callback=None, errback=None, params={}):
"""
Search within a zone for specific metadata. Zone must already be loaded.
"""
if not self.data:
raise ZoneException("zone not loaded")

return self._rest.search(self.zone, q, has_geo, callback, errback)
return self._rest.search(self.zone, q, has_geo, callback, errback, params)

def delete(self, callback=None, errback=None):
"""
Expand Down