text: # coding: utf-8
  
  """
      Experimental Looker API 3.1 Preview
  
      This API 3.1 is in active development. Breaking changes are likely to occur to some API functions in future Looker releases until API 3.1 is officially launched and upgraded to beta status.  If you have time and interest to experiment with new or modified services exposed in this embryonic API 3.1, we welcome your participation and feedback!  For large development efforts or critical line-of-business projects, we strongly recommend you stick with the API 3.0 while API 3.1 is under construction.   # noqa: E501
  
      OpenAPI spec version: 3.1.0
      
      Generated by: https://github.com/swagger-api/swagger-codegen.git
  """
  
  
  from __future__ import absolute_import
  
  import re  # noqa: F401
  
  # python 2 and python 3 compatibility library
  import six
  
  from looker_client_31.api_client import ApiClient
  
  
  class SessionApi(object):
      """NOTE: This class is auto generated by the swagger code generator program.
  
      Do not edit the class manually.
      Ref: https://github.com/swagger-api/swagger-codegen
      """
  
      def __init__(self, api_client=None):
          if api_client is None:
              api_client = ApiClient()
          self.api_client = api_client
  
      def session(self, **kwargs):  # noqa: E501
          """Get Session  # noqa: E501
  
          ### Get API Session  Returns information about the current API session, such as which workspace is selected for the session.   # noqa: E501
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please pass async=True
          >>> thread = api.session(async=True)
          >>> result = thread.get()
  
          :param async bool
          :return: ApiSession
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('async'):
              return self.session_with_http_info(**kwargs)  # noqa: E501
          else:
              (data) = self.session_with_http_info(**kwargs)  # noqa: E501
              return data
  
      def session_with_http_info(self, **kwargs):  # noqa: E501
          """Get Session  # noqa: E501
  
          ### Get API Session  Returns information about the current API session, such as which workspace is selected for the session.   # noqa: E501
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please pass async=True
          >>> thread = api.session_with_http_info(async=True)
          >>> result = thread.get()
  
          :param async bool
          :return: ApiSession
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = []  # noqa: E501
          all_params.append('async')
          all_params.append('_return_http_data_only')
          all_params.append('_preload_content')
          all_params.append('_request_timeout')
  
          params = locals()
          for key, val in six.iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method session" % key
                  )
              params[key] = val
          del params['kwargs']
  
          collection_formats = {}
  
          path_params = {}
  
          query_params = []
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.select_header_accept(
              ['application/json'])  # noqa: E501
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
              ['application/json'])  # noqa: E501
  
          # Authentication setting
          auth_settings = []  # noqa: E501
  
          return self.api_client.call_api(
              '/session', 'GET',
              path_params,
              query_params,
              header_params,
              body=body_params,
              post_params=form_params,
              files=local_var_files,
              response_type='ApiSession',  # noqa: E501
              auth_settings=auth_settings,
              async=params.get('async'),
              _return_http_data_only=params.get('_return_http_data_only'),
              _preload_content=params.get('_preload_content', True),
              _request_timeout=params.get('_request_timeout'),
              collection_formats=collection_formats)
  
      def update_session(self, body, **kwargs):  # noqa: E501
          """Update Session  # noqa: E501
  
          ### Update API Session  #### API Session Workspace  You can use this endpoint to change the active workspace for the current API session.  Only one workspace can be active in a session. The active workspace can be changed any number of times in a session.  The default workspace for API sessions is the \"production\" workspace.  All Looker APIs that use projects or lookml models (such as running queries) will use the version of project and model files defined by this workspace for the lifetime of the current API session or until the session workspace is changed again.  An API session has the same lifetime as the access_token used to authenticate API requests. Each successful API login generates a new access_token and a new API session.  If your Looker API client application needs to work in a dev workspace across multiple API sessions, be sure to select the dev workspace after each login.   # noqa: E501
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please pass async=True
          >>> thread = api.update_session(body, async=True)
          >>> result = thread.get()
  
          :param async bool
          :param ApiSession body: Session (required)
          :return: ApiSession
                   If the method is called asynchronously,
                   returns the request thread.
          """
          kwargs['_return_http_data_only'] = True
          if kwargs.get('async'):
              return self.update_session_with_http_info(body, **kwargs)  # noqa: E501
          else:
              (data) = self.update_session_with_http_info(body, **kwargs)  # noqa: E501
              return data
  
      def update_session_with_http_info(self, body, **kwargs):  # noqa: E501
          """Update Session  # noqa: E501
  
          ### Update API Session  #### API Session Workspace  You can use this endpoint to change the active workspace for the current API session.  Only one workspace can be active in a session. The active workspace can be changed any number of times in a session.  The default workspace for API sessions is the \"production\" workspace.  All Looker APIs that use projects or lookml models (such as running queries) will use the version of project and model files defined by this workspace for the lifetime of the current API session or until the session workspace is changed again.  An API session has the same lifetime as the access_token used to authenticate API requests. Each successful API login generates a new access_token and a new API session.  If your Looker API client application needs to work in a dev workspace across multiple API sessions, be sure to select the dev workspace after each login.   # noqa: E501
          This method makes a synchronous HTTP request by default. To make an
          asynchronous HTTP request, please pass async=True
          >>> thread = api.update_session_with_http_info(body, async=True)
          >>> result = thread.get()
  
          :param async bool
          :param ApiSession body: Session (required)
          :return: ApiSession
                   If the method is called asynchronously,
                   returns the request thread.
          """
  
          all_params = ['body']  # noqa: E501
          all_params.append('async')
          all_params.append('_return_http_data_only')
          all_params.append('_preload_content')
          all_params.append('_request_timeout')
  
          params = locals()
          for key, val in six.iteritems(params['kwargs']):
              if key not in all_params:
                  raise TypeError(
                      "Got an unexpected keyword argument '%s'"
                      " to method update_session" % key
                  )
              params[key] = val
          del params['kwargs']
          # verify the required parameter 'body' is set
          if ('body' not in params or
                  params['body'] is None):
              raise ValueError("Missing the required parameter `body` when calling `update_session`")  # noqa: E501
  
          collection_formats = {}
  
          path_params = {}
  
          query_params = []
  
          header_params = {}
  
          form_params = []
          local_var_files = {}
  
          body_params = None
          if 'body' in params:
              body_params = params['body']
          # HTTP header `Accept`
          header_params['Accept'] = self.api_client.select_header_accept(
              ['application/json'])  # noqa: E501
  
          # HTTP header `Content-Type`
          header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
              ['application/json'])  # noqa: E501
  
          # Authentication setting
          auth_settings = []  # noqa: E501
  
          return self.api_client.call_api(
              '/session', 'PATCH',
              path_params,
              query_params,
              header_params,
              body=body_params,
              post_params=form_params,
              files=local_var_files,
              response_type='ApiSession',  # noqa: E501
              auth_settings=auth_settings,
              async=params.get('async'),
              _return_http_data_only=params.get('_return_http_data_only'),
              _preload_content=params.get('_preload_content', True),
              _request_timeout=params.get('_request_timeout'),
              collection_formats=collection_formats)
  