简体   繁体   中英

Authenticating and transferring CSV files from GCS to a remote network drive in Python

I'm wanting to use a containerised Python app to connect and authenticate to an AD managed.network drive on a physical file server to then transfer some csv files to it from a Google Cloud bucket and I'm wondering what the best options are to do this?

So far I have established that I can see the server using:

    try:
        smbclient.register_session("xx.xx.xx.xx", username="user", password="pass")
    except Exception as exec:
        print(exec)

But this leads me to the problem of the best way to authenticate against it. I'm unfortunately not a very experienced programmer, I was wondering if there was some sort of token exchange that I could implement?

I used:

mount_string = f'mount -t cifs -o username={secret_dict["user"]}, {secret_dict["password"]} //<serverip>/<share> {mount}'

try:
    os.system(mount_string)
except Exception as exec:
    print(exec)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM