CMS 3D CMS Logo

credentials.py
Go to the documentation of this file.
1 import netrc
2 import os
3 
4 netrcFileName = '.netrc'
5 
6 def get_credentials_from_file( service, authFile=None ):
7  if not authFile is None:
8  if os.path.isdir(authFile):
9  authFile = os.path.join( authFile, netrcFileName )
10  creds = netrc.netrc( authFile ).authenticators(service)
11  return creds
12 
13 def get_credentials( authPathEnvVar, service, authFile=None ):
14  if authFile is None:
15  if authPathEnvVar in os.environ:
16  authPath = os.environ[authPathEnvVar]
17  authFile = os.path.join(authPath, netrcFileName)
18  return get_credentials_from_file( service, authFile )
19 
def get_credentials(authPathEnvVar, service, authFile=None)
Definition: credentials.py:13
def get_credentials_from_file(service, authFile=None)
Definition: credentials.py:6