(self, request, tenant_id)
return json.dumps({'metadata': metadata,
                           'values': [entity.to_json() for entity in entities]})
Replies the entities list call
Replies the entities list call
Replies the entities list call
def list_entities(self, request, tenant_id):
        """
        Replies the entities list call
        """
        entities = list(self._entity_cache_for_tenant(
            tenant_id).entities.values())

        limit = 100
        marker = None
        next_marker = None
        next_href = None
        if b'limit' in request.args:
            limit = int(request.args[b'limit'][0].strip())
        if b'marker' in request.args:
            marker = request.args[b'marker'][0].strip().decode("utf-8")
            for q in range(len(entities)):
                if entities[q].id == marker:
                    entities = entities[q:]
                    break
        try:
            next_marker = entities[limit].id
        except Exception:
            pass
        entities = entities[:limit]

        metadata = {'count': len(entities),
                    'limit': limit,
                    'marker': marker,
                    'next_marker': next_marker,
                    'next_href': next_href}
        request.setResponseCode(200)
        return json.dumps({'metadata': metadata,
                           'values': [entity.to_json() for entity in entities]})
def list_entities ( self , request , tenant_id ) : entities = list ( self . _entity_cache_for_tenant ( tenant_id ) . entities . values ( ) ) limit = 100 marker = None next_marker = None next_href = None if b'limit' in request . args : limit = int ( request . args [ b'limit' ] [ 0 ] . strip ( ) ) if b'marker' in request . args : marker = request . args [ b'marker' ] [ 0 ] . strip ( ) . decode ( "utf-8" ) for q in range ( len ( entities ) ) : if entities [ q ] . id == marker : entities = entities [ q : ] break try : next_marker = entities [ limit ] . id except Exception : pass entities = entities [ : limit ] metadata = { 'count' : len ( entities ) , 'limit' : limit , 'marker' : marker , 'next_marker' : next_marker , 'next_href' : next_href } request . setResponseCode ( 200 ) return json . dumps ( { 'metadata' : metadata , 'values' : [ entity . to_json ( ) for entity in entities ] } )