google-code-export / googlecl

Automatically exported from code.google.com/p/googlecl
2 stars 0 forks source link

Add ManageServiceCL for management tasks of GoogleCL (for token deletion atm) #413

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What service (Calendar, Docs, Picasa) should be enhanced?

GoogleCL

What is the enhancement?

Allow to list/check access tokens and to delete.

With the patch, you can do:

  ./google.py manage list-tokens

You will be asked for username for the first, it acts as other normal service, 
so a default account will be associated with "manage" service. As same as other 
service, you can use `--user newemail@example.com` to override.

It will list current tokens, example output:

Tokens of user email@example.com:
 picasa  : no token found
 blogger : valid
 youtube : no token found
 docs    : invalid
 contacts: no token found
 calendar: no token found
 finance : no token found

Then you can delete by running:

  ./google.py manage delete-tokens docs

It can also accept multiple service at one time, e.g.

  ./google.py manage delete-tokens docs blogger picasa

I made this because Issue 401.

I decided to make this like a service because the Tasks handling is useful 
already. This is also possibly to be expanded to more complicated management 
tasks if any.

A small note, I modified the `remove_access_token` of `AuthenticationManager`, 
it doesn't remove the token somehow but `return True` and file modification 
date indeed changed, however the file content didn't, I don't know if that's 
`"r+"` issue or needs to do something (reset position?) I simply re-open the 
file to get around it.

Original issue reported on code.google.com by livibet...@gmail.com on 7 Aug 2011 at 10:06

Attachments: