上传到Google云端硬盘没有任何用户界面 [英] Upload to Google Drive without any UI?

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

问题描述

我期望编写一个服务器应用程序将文件上传到Google Drive。我以前使用文档列表API,但我发现这已被弃用。我希望转移到Google Drive API,但似乎只限于使用网络/ OAuth流程。



我需要做的只是上传Word,Excel文件等到Google Drive,但我需要以完全自动的方式完成此操作,而不需要任何用户界面。我希望编写一个命令行应用程序,它可以运行在cron或其他任何应用程序上,而不需要通过web等进行人为干预。



我宁愿退出Documents List API,因为我不想在最终关闭它时被烧毁,所以我想使用支持的API,Google不会很快摆脱它。这是否存在?



谢谢

Garry

解决方案

您的应用程序需要用户对其文件使用API​​的权限。该授权需要使用基于Web的Oauth进行。该授权的结果是您的服务器应用程序以一个可以存储的刷新令牌结束。在任何时候,您的应用程序都可以将该刷新令牌转换为访问令牌并访问驱动器文件。



因此,只要您接受您需要一次性授权,你可以实现你正在寻找的东西。


I am looking to write a server application to upload files to Google Drive. I was previously using the Documents List API, but I see that is deprecated. I'd like to move to the Google Drive API, but that seems very restricted to using a web/OAuth flow.

All I need to do is upload Word, Excel files etc. to Google Drive, but I need to do this in an entirely automated manner, with no user interface of any kind. I wish to write a command line application, which can run on cron or whatever, and not require human intervention via the web etc.

I'd rather move away from Documents List API, as I don't want to get burned when they eventually turn it off, I'd like to use a supported API which Google are not going get rid of any time soon. Does this exist?

Thanks

Garry

解决方案

Your application needs the user's permission to use the API against his files. That authorisation needs to happen using web based Oauth. The result of that authorisation is your server app ends up with a refresh token, which it can store. At any time, your app can convert that refresh token to an access token and access the drive files.

So, provided you accept that you need to do a one-time authorisation, you can achieve what you are looking for.

这篇关于上传到Google云端硬盘没有任何用户界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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