def get_google_api_auth(module, scopes=[], user_agent_product='ansible-python-api', user_agent_version='NA'):
 if (not HAS_GOOGLE_API_LIB):
  module.fail_json(msg='Please install google-api-python-client library')
 if (not scopes):
  scopes = ['https://www.googleapis.com/auth/cloud-platform']
 try:
  (credentials, conn_params) = get_google_credentials(module, scopes, require_valid_json=True, check_libcloud=False)
  http = set_user_agent(Http(), ('%s-%s' % (user_agent_product, user_agent_version)))
  http_auth = credentials.authorize(http)
  return (http_auth, conn_params)
 except Exception as e:
  module.fail_json(msg=unexpected_error_msg(e), changed=False)
  return (None, None)

def get_google_api_auth ( module , scopes = [ ] , user_agent_product = 'ansible-python-api' , user_agent_version = 'NA' ) : if ( not HAS_GOOGLE_API_LIB ) : module . fail_json ( msg = 'Please install google-api-python-client library' ) if ( not scopes ) : scopes = [ 'https://www.googleapis.com/auth/cloud-platform' ] try : ( credentials , conn_params ) = get_google_credentials ( module , scopes , require_valid_json = True , check_libcloud = False ) http = set_user_agent ( Http ( ) , ( '%s-%s' % ( user_agent_product , user_agent_version ) ) ) http_auth = credentials . authorize ( http ) return ( http_auth , conn_params ) except Exception as e : module . fail_json ( msg = unexpected_error_msg ( e ) , changed = False ) return ( None , None )
authentication for use with google-python-api-client .