Skip to content

Alerta doesn't return all alert with get_alerts #317

Closed
@francesco-amato-argo

Description

@francesco-amato-argo

Hi,
I noticed that alerta doesn't return all alert with function get_alerts
I think that the problem is the pagination

I changed the code of api.py to get function working

def get_alerts(self, query=None, page=1, page_size=None):
r = self.http.get('/alerts', query, page=page, page_size=page_size)
data = [Alert.parse(a) for a in r['alerts']]
while r['pages'] > r['page']:
r = self.http.get('/alerts', query, page=r['page']+1, page_size=page_size)
data.extend([Alert.parse(a) for a in r['alerts']])
return data

I hope it can help someone else with the same problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions