Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »





cql confluence
def get_credential():
   import yaml
   credentialfilename = r'../credential.yaml'
   diccredential = yaml.load(open(credentialfilename))
   urlbase = diccredential['urlbase']
   auth = HTTPBasicAuth(diccredential['username'], diccredential['key'])
   #credentialfilename.close()
   return (urlbase,auth)

def main():
   # get credential
   returntuple = get_credential()
   urlbase = returntuple[0]
   auth = returntuple[1]

napalm
def get_credential():
   import yaml
   credentialfilename = r'credential_napalm.yaml'
   diccredential = yaml.load(open(credentialfilename))
   hostname = diccredential['hostname']
   username = diccredential['username']
   password = diccredential['password']
   port = diccredential['optional_args']['port']
   #credentialfilename.close()
   return (hostname,username,password,port)


def main():
    # get credential
    returntuple = get_credential()
    hostname = returntuple[0]
    username = returntuple[1]
    password = returntuple[2]
    port = returntuple[3]
    print(hostname,username,password,port)


  • No labels