prayagverma / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

OAuth2 authentication for older class gdata.spreadsheet.service.SpreadsheetsService #594

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. gd_client = gdata.spreadsheet.service.SpreadsheetsService()
2. token = gdata.gauth.OAuth2Token( ... )
3. token.authorize(gd_client)
4. gd_client.GetSpreadsheetsFeed()

Error: Exception Value: 
new_request() takes exactly 1 non-keyword argument (2 given)
Exception 
Location:   /home/victor/.virtualenvs/locaweb/lib/python2.6/site-packages/gdata-2.
0.16-py2.6.egg/atom/http_interface.py in perform_request, line 148

What is the expected output? What do you see instead?

I want to get a list of Spreadsheets

What version of the product are you using?

2.0.16

Please provide any additional information below.

Problem: I want to use the class gdata.spreadsheet.service.SpreadsheetsService 
authenticated with OAuth2. Is it possible ?
I read an other issue that the OAuth2 only works with new client class 
gdata.spreadsheets.client.SpreadsheetsClient. It works for me using the new 
class. My problem: The new class SpreadsheetsClient is imcomplete at the moment 
and not exists the documentation for it. I want to use methods like: 
AddWorksheet, UpdateWorksheet, DeleteWorksheet, UpdateCell and others, 
available only in older class (SpreadsheetsService).

Should i change the type of the authentication (OAuth2 to OAuth) ?

There is any way to make that new version of the class SpreadsheetsClient use 
the basic operations of spreadsheets, like updateCell, updateWorksheet and 
others, it is really imcomplete at the moment ? the basic operation UpdateCell 
is not available for the new Client ?

Help me people, i want to use the integration of Google Docs in my system. 

Original issue reported on code.google.com by victorja...@gmail.com on 8 Feb 2012 at 8:52

GoogleCodeExporter commented 9 years ago
Hi, thanks for this.

Yes, unfortunately if you want to use the old service framework-based class, 
you will have to use OAuth1, not OAuth2.0. We won't be adding OAuth2.0 support 
to the old service framework.

Original comment by afs...@google.com on 13 Feb 2012 at 3:34

GoogleCodeExporter commented 9 years ago
What is the old service framework and what is the new one?

There's no mention about it in here: 
https://developers.google.com/gdata/articles/python_client_lib

Original comment by eduardos...@gmail.com on 19 Dec 2012 at 3:22

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
If you write an OAuth 2.0 Bearer auth header directly to the request it will 
allow you to continue to use the older 
gdata.spreadsheet.service.SpreadsheetsService style client code with the new 
OAuth 2.0 access tokens. 

Init your client like this:
client = gdata.spreadsheet.service.SpreadsheetsService(
    additional_headers={'Authorization' : 'Bearer %s' % credentials.access_token})

I have put a full working solution in my SO answer here 
http://stackoverflow.com/a/29157967/298650

Original comment by peter.he...@gmail.com on 23 Mar 2015 at 2:44