Create a new /info endpoint #9
Conversation
|
||
output['total_connections'] = model.Connection.search( | ||
session, ip=ipaddr, cnt=True) | ||
output['active_connections'] = model.Connection.by_ip( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use search
for both queries or by_ip
for both queries? They seem to do the same thing in this case.
Edit: In all cases, actually
This endpoint aims at returning information about the session attached to the current IP.
Both method were basically doing the same thing now, so let's just keep one of them, as pointed out by Jeremy Cline in the review
Good call, I just dropped by_id() and replaced it with calls to search() instead. Thanks :) |
|
||
{% if ip in config['IP_UNLIMITED'] %} | ||
This IP can have un-limited sessions. | ||
{% elif ip in config['IP_UNLIMITED'] %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe this was meant to be 'IP_BLOCKED' or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds right :D
Other than the one kwarg which I think is wrong, this looks good 👍 |
I'm going to merge this, thanks for the review :) |
This endpoint returns information about the number of sessions total and active associated
to this IP.