How to use the habanero.filterhandler.filter_handler function in habanero

To help you get started, we’ve selected a few habanero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sckott / habanero / habanero / request_class.py View on Github external
def do_request(self):
    filt = filter_handler(self.filter)
    if self.select.__class__ is list:
      self.select = ','.join(self.select)

    if not isinstance(self.cursor_max, (type(None), int)):
      raise ValueError("cursor_max must be of class int")

    payload = {'query':self.query, 'filter':filt, 'offset':self.offset,
               'rows':self.limit, 'sample':self.sample, 'sort':self.sort,
               'order':self.order, 'facet':self.facet, 'select':self.select,
               'cursor':self.cursor}
    payload = dict((k, v) for k, v in payload.items() if v)
    # add query filters
    payload.update(filter_dict(self.kwargs))
    # rename query filters
    payload = rename_query_filters(payload)
github sckott / habanero / habanero / request.py View on Github external
def request(mailto, ua_string, url, path, ids = None, query = None, filter = None,
        offset = None, limit = None, sample = None, sort = None,
        order = None, facet = None, select = None, works = None,
        cursor = None, cursor_max = None, agency = False, 
        progress_bar = False, **kwargs):

  url = url + path

  if cursor_max.__class__.__name__ != 'NoneType':
    if cursor_max.__class__ != int:
      raise ValueError("cursor_max must be of class int")

  filt = filter_handler(filter)
  if select.__class__ is list:
    select = ','.join(select)

  payload = {'query':query, 'filter':filt, 'offset':offset,
             'rows':limit, 'sample':sample, 'sort':sort,
             'order':order, 'facet':facet, 'select':select,
             'cursor':cursor}
  payload = dict((k, v) for k, v in payload.items() if v)
  # add query filters
  payload.update(filter_dict(kwargs))
  # rename query filters
  payload = rename_query_filters(payload)

  if(ids.__class__.__name__ == 'NoneType'):
    url = url.strip("/")
    try: