ClientSession#
- class fourinsight.api.ClientSession(client_id, client_secret)[source]#
Authorized session where credentials are given as client_id and client_secret. When valid credentials are presented, the session is authenticated and persisted.
Extends
BaseAuthSession
.- Parameters:
- get(*args, **kwargs)[source]#
Extend the
requests_oauthlib.OAuth2Session.get
method to ensure that internal API are not accessed.
- get_pages(url, **kwargs)[source]#
Sends GET requests, and returns a generator that lets the user iterate over paginated responses. Note that the endpoint must support OData; the json response should include the a parameter ‘@odata.nextLink’, providing the URL for the next page.
- Parameters:
url (str) – API endpoint. To return pages, the endpoint must support OData and contain the parameter ‘@odata.nextLink’.
**kwargs – Optional keyword arguments. Will be passed on to the
get
method.
- Yields:
response (obj) – The response as a
Response
object.