Software, Internet and related
I had to host some files on Google Drive and they needed to be updated on regular basis. Going through the GUI is a tedious task if repeated often, so I ended up coding my own upload code.
The upload login is just using the Google SDK, but the tricky part is the authentication with the Google Services, which is OAuth 2.0 ticket base and needs interaction at least for the first run of the program.
Here is the Google Drive encapsulated logic. It exposes methods for listing the drive contents, downloading and uploading:
And here is the application logic. It’s just a command line utility that accepts the client Id and secret as first parameter and the file to be uploaded as third:
And the rest is the most tricky part. The authentication: