api: Add is_remote_server().

This function abstracts the logic to ascertain the source of API
auth request.
This commit is contained in:
Umair Khan 2017-04-28 09:55:22 +05:00 committed by Tim Abbott
parent 2c64626e7a
commit 252fa53816
1 changed files with 9 additions and 0 deletions

View File

@ -223,3 +223,12 @@ def split_by(array, group_size, filler):
"""
args = [iter(array)] * group_size
return list(map(list, zip_longest(*args, fillvalue=filler)))
def is_remote_server(identifier):
# type: (Text) -> bool
"""
This function can be used to identify the source of API auth
request. We can have two types of sources, Remote Zulip Servers
and UserProfiles.
"""
return "@" not in identifier