Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_factor(self, user_id, user_factor_id):
"""Get information about an enrolled factor
:param user_id: target user id
:type user_id: str
:param user_factor_id: target factor id
:type user_factor_id: str
:rtype: Factor
"""
response = ApiClient.get_path(self, '/{0}/factors/{1}'.format(user_id, user_factor_id))
return Utils.deserialize(response.text, Factor)
def validate_session(self, id):
"""Validate a session
:param id: the target session id
:rtype: Session
"""
response = ApiClient.get_path(self, '/{0}'.format(id))
return Utils.deserialize(response.text, Session)
def get_factors_catalog(self, user_id):
"""Get available factors for a user
:param user_id: target user id
:type user_id: str
:rtype: list of FactorCatalogEntry
"""
response = ApiClient.get_path(self, '/{0}/factors/catalog'.format(user_id))
return Utils.deserialize(response.text, FactorCatalogEntry)
:type filter_string: str or None
:param after: user id that filtering will resume after
:type after: str
:param url: url that returns a list of User
:type url: str
:rtype: PagedResults of User
"""
if url:
response = ApiClient.get(self, url)
else:
params = {
'limit': limit,
'after': after,
'filter': filter_string
}
response = ApiClient.get_path(self, '/', params=params)
return PagedResults(response, User)
def get_group(self, gid):
"""Get a single group
:param gid: the group id
:type gid: str
:rtype: UserGroup
"""
response = ApiClient.get_path(self, '/{0}'.format(gid))
return Utils.deserialize(response.text, UserGroup)
def get_lifecycle_factors(self, user_id):
"""Get enrolled factors for a user
:param user_id: target user id
:type user_id: str
:rtype: list of Factor
"""
response = ApiClient.get_path(self, '/{0}/factors'.format(user_id))
return Utils.deserialize(response.text, Factor)
:type limit: int or None
:param after: group id that filtering will resume after
:type after: str
:param url: url that returns a list of UserGroup
:type url: str
:rtype: PagedResults of UserGroup
"""
if url:
response = ApiClient.get(self, url)
else:
params = {
'limit': limit,
'after': after
}
response = ApiClient.get_path(self, '/', params=params)
return PagedResults(response, UserGroup)
"""Get a list of Users
:param limit: maximum number of users to return
:type limit: int or None
:param query: string to search users' first names, last names, and emails
:type query: str or None
:param filter_string: string to filter users
:type filter_string: str or None
:rtype: list of User
"""
params = {
'limit': limit,
'q': query,
'filter': filter_string
}
response = ApiClient.get_path(self, '/', params=params)
return Utils.deserialize(response.text, User)
:type after: str or None
:param url: url that returns a list of Event
:type url: str or None
:rtype: PagedResults of Event
"""
if url:
response = ApiClient.get(self, url)
else:
params = {
'limit': limit,
'startDate': start_date,
'after': after,
'filter': filter_string
}
response = ApiClient.get_path(self, '/', params=params)
return PagedResults(response, Event)