Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.






Code Block
titlecql 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]




Code Block
titlenapalm
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)