Help finalizing and improving Python script

I need help to finalize my Python script for generating a control report from various hosts on Citrix netscaler sdx.

How do I finalize the out_file line below ???

if __name__ == "__main__":
    with open('sdx_list.csv') as sdx_csv_file:
        sdx_list = [(hostname, socket.gethostbyname(hostname)) for hostname in [x.strip() for x in (sdx_csv_file)]]
    out_file = open('output.csv', 'w')
    for sdx in sdx_list:
            token = nitro_login(sdx[1], os.getenv('sdx_username'), os.getenv('sdx_password'))
        except: pass
        if token:
            comm_method = get_ns_comm(sdx[0], token)
            nsroot = nitro_login_nsroot(sdx[0])
            ntp = get_ntp(sdx[0], token)
            tls = get_tls(sdx[0], token)
            syslog = get_syslog(sdx[0], token)
            system_timeout = get_system_timeout(sdx[0], token)
            with open('output.csv', 'a') as results:

Is it "out_file(results)" or ???

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.