Ignore requests by users
Closed this issue · 5 comments
leogregianin commented
There are users for that I don't need to capture the requests.
Can we create a filter to ignore requests from certain users?
My idea is to create two new configurations:
DEFAULT_SETTINGS = {
...
'IGNORE_USER_FIELD': '',
'IGNORE_USERS': [],
}
My own configuration would look like this:
REQUESTLOGS = {
...
'IGNORE_USER_FIELD': 'username',
'IGNORE_USERS': ['username1', 'username2'],
}
or
REQUESTLOGS = {
...
'IGNORE_USER_FIELD': 'email',
'IGNORE_USERS': ['email@email1.com', 'email@email2.com'],
}
and finalize()
method in RequestLogEntry class
do:
self.response = self.response_handler(response)
if SETTINGS['IGNORE_USER_FIELD']:
if (self.user.get(SETTINGS['IGNORE_USER_FIELD'], None) in SETTINGS['IGNORE_USERS']):
return None
self.store()
@Raekkeri, what do you think about this?
Raekkeri commented
I think it is ok to include this kind of feature. Also a unittest for this would be nice. Or I can implement this in some time.
leogregianin commented
Thanks @Raekkeri 👏
Raekkeri commented
@leogregianin Thanks for your contribution!