如何使用Python脚本将文件上传到Google云端硬盘? [英] How to upload a file to Google Drive using a Python script?

查看:340
本文介绍了如何使用Python脚本将文件上传到Google云端硬盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从某些linux服务器上将各种文件类型备份到GDrive(不仅仅是可转换为GDocs格式的文件).

I need to backup various file types to GDrive (not just those convertible to GDocs formats) from some linux server.

用python脚本做到这一点的最简单,最优雅的方法是什么?与GDocs有关的任何解决方案都适用吗?

What would be the simplest, most elegant way to do that with a python script? Would any of the solutions pertaining to GDocs be applicable?

推荐答案

您可以使用Documents List API编写一个写入Drive的脚本:

You can use the Documents List API to write a script that writes to Drive:

https://developers.google.com/google-apps/documents-list/

Documents List API和Drive API都使用相同的资源(即相同的文档和文件)进行交互.

Both the Documents List API and the Drive API interact with the same resources (i.e. same documents and files).

Python客户端库中的此示例显示了如何将未转换的文件上传到云端硬盘:

This sample in the Python client library shows how to upload an unconverted file to Drive:

http://code.google.com/p/gdata-python-client/source/browse/samples/docs/docs_v3_example.py#180

这篇关于如何使用Python脚本将文件上传到Google云端硬盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆