Closed vinitkumar closed 7 years ago
I was also saddened by googlecl stopping to work, as I used it heavily for uploading photos into my Picasa web album. But after looking around I found the "picasawebsync" project (https://github.com/leocrawford/picasawebsync) which made me realise it actually wasn't too hard to get upload to picasa working again. The picasawebsync program was way too complicated for my needs (plus making too many assumptions and modifications to the structure of the web albums), but it wasn't hard to build on the ideas and code there, to get something closer to what I wanted (and to googlecl's original Picasa features) in just 100 lines of code.
The result is http://nadav.harel.org.il/pub/picasa-upload - feel free to build on it, copy it, learn from it or whatever :-) It takes an album title and a list of files, and uploads all those files into a new or existing (it lets you choose interactively) album. Files that are already in the destination album (checked by a checksum) are not uploaded again. It's working very well, even more convenient for me than the original googlecl ;-)
As you can see in my link, the oauth2 login part is actually pretty easy - I have a client() function which returns a working API client - it involves the user in the manual login process once, and then automatically "refreshes" the token if more than 55 minutes passed since the last operation (apparently the default token expiration is one hour), but this is all transparent to the code, which just uses client() which usually just returns instantly.
The big snag, however, is that with oauth2, in order to use the API you need a "client ID", basically an ID for your application. You'll need to create an ID for your application as explained in https://developers.google.com/console/help/new/?hl=en_US#generatingoauth2 - my picasa-upload.py assumes you put the id in ~/.client_secrets.json. As interesting question is whether it makes sense to actually publish to the world a version of googlecl with your own application ID embedded into it (and not ask every user to get one). I think the answer is yes, but please think hard if there are negative implications before doing that.
@nyh Thanks for your comment. This really helps.
Not sure if this is related, but I'm trying to edit a doc, and it says this:
❯ google docs edit "Plain Resume" [11:06:12]
Please specify user: trusktr
Unable to obtain OAuth request token: 307, <HTML>
<HEAD>
<TITLE>Temporary Redirect</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Temporary Redirect</H1>
The document has moved <A HREF="https://accounts.google.com/OAuthGetRequestToken?scope=
https%3A%2F%2Fdocs.google.com%2Ffeeds%2F+https%3A%2F%2Fspreadsheets.google.com%2Ffeeds%
2F+https%3A%2F%2Fdocs.googleusercontent.com%2F+https%3A%2F%2Fspreadsheets.google.com%2F
feeds%2F+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo%23email&xoauth_displayn
ame=GoogleCL+trusktr%40starlancer">here</A>.
</BODY>
</HTML>
Failed to get valid access token!
It didn't ask for a password or anything. Is that what this issue is about?
@trusktr This issue is related to the way google apis handle auth now.
@vinitkumar Is that what my error is up there, or should I open a new issue for that?
I was hoping to use this for live coding, syncing to a Google Doc tomorrow, but, doesn't look like I'll have luck with that!
Closing as it is already being tracked by #251
Hello Vinit.
Any progress on this? Thanks for your efforts.
On Sat, 29 Aug 2015 at 22:59 Vinit Kumar notifications@github.com wrote:
Since google has changed the way we talk with the gdata api. We need Oauth2 to talk to the APIs. Hereby, is the plan to do the migration.
- Add the the previous scopes which still works to the scope while getting the access token.
- Find which other services can be easily integrated into the googlecl services (maybe shortener, gmail?)
- Remove the services if they won't work with the new breaking changes to the gdata API.
- Write proper documentation to the changes done.
- Try and break as little API and ensure it is mostly backward compatible.
Note: This issue is for my reference and planning purpose and is related to #251 https://github.com/vinitkumar/googlecl/issues/251 #250 https://github.com/vinitkumar/googlecl/issues/250.
— Reply to this email directly or view it on GitHub https://github.com/vinitkumar/googlecl/issues/255.
@gevrey I suggest you check the readme. https://github.com/vinitkumar/googlecl/blob/master/README.md
Since google has changed the way we talk with the
gdata
api. We need Oauth2 to talk to the APIs. Hereby, is the plan to do the migration.Note: This issue is for my reference and planning purpose and is related to #251 #250.