Download files from personal OneDrive using Python

前端 未结 2 911
失恋的感觉
失恋的感觉 2021-02-03 12:41

I have a Python script that is running periodically on an AWS EC2 Ubuntu machine.

This script reads data from some files and sometimes changes data in them.

I wa

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-03 12:59

    Python library that can help with this:

    pip install cloudsync

    then:

    import cloudsync
    
    prov = cloudsync.create_provider("onedrive")
    creds = prov.authenticate()
    prov.connect(creds)
    with open("/my/local/file", "wb") as f:
        prov.download_path("/path/to/file/on/onedrive", f):
    

提交回复
热议问题