gdata-python-client's Issues
Python3 version is needed
Hi all,
I would like to use gdata with python3.
Gdata gauth.py / http_core.py does not support http_proxy while rest of the API does
https://github.com/google/gdata-python-client/blob/master/src/atom/http_core.py#L19
I personally used it for google sites backup , it is strange that the Authentication part to create a session does not support http proxy and the rest of the api after generating a session file does ... That line is from 2009.
I can confirm that once the session file is created the rest of the api uses the "http_proxy" environment variable and correctly handle the connection.
Audit Does not work with OAuth2->token signed connections.
def __init__( self, cmdparse, http_client = httplib2.Http() ):
self.o2_credentials = (
SignedJwtAssertionCredentials( self.c.clientemail,
private_key, scope=SCOPES, sub=self.c.adminaccount ) )
self.http_auth = self.o2_credentials.authorize( http_client )
self.auth2token = OAuth2TokenFromCredentials( self.o2_credentials )
....
self.token = ga.auth2token.authorize(
gdata.apps.audit.service.AuditService( domain = domain ) )
....
Calling createMailboxExportRequest results in the following. I suspect the Audit service is using a completely different style of http client class? I tried some simple changes, but nothing obvious. Replacing the http_client with atom.http.HttpClient() results in unauthorized calls. Thoughts?
File "/usr/lib/python2.7/site-packages/gdata/apps/audit/service.py", line 230, in createMailboxExportRequest
return self._PostProperties(uri, properties)
File "/usr/lib/python2.7/site-packages/gdata/apps/service.py", line 530, in _PostProperties
str(self.Post(property_entry, uri))))
File "/usr/lib/python2.7/site-packages/gdata/service.py", line 1236, in Post
media_source=media_source, converter=converter)
File "/usr/lib/python2.7/site-packages/gdata/service.py", line 1322, in PostOrPut
headers=extra_headers, url_params=url_params)
File "/usr/lib/python2.7/site-packages/atom/init.py", line 93, in optional_warn_function
return f(_args, *_kwargs)
File "/usr/lib/python2.7/site-packages/atom/service.py", line 186, in request
data=data, headers=all_headers)
File "/usr/lib/python2.7/site-packages/atom/http_interface.py", line 148, in perform_request
return http_client.request(operation, url, data=data, headers=headers)
TypeError: new_request() takes exactly 1 argument (4 given)
import gdata.books fails since books module not in source
I've downloaded the latest source and followed the instructions in INSTALL.txt
When I execute run_data_tests.py, it fails with:
books_test.py, line 9, in
import gdata.books
ImportError: No module named books
In gdata directory, there is no module named books.
Not sure if I missed a configuration step?
gdata spreadsheet examples stop working
I knew I need to use oauth2 to be able to do that. I tried to modify my script to this post
http://stackoverflow.com/questions/16026286/using-oauth2-with-service-account-on-gdata-in-python
Then I got this error
Traceback (most recent call last):
File "/Applications/PyCharm.app/helpers/pydev/pydevd.py", line 1733, in
debugger.run(setup['file'], None, None)
File "/Applications/PyCharm.app/helpers/pydev/pydevd.py", line 1226, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Users/tom/projects/jolu/mobile_framework/tools/config/test.py", line 24, in
feed = gd_client.GetWorksheetsFeed("11HnWT0tHZsRdSd4nY5gktoh0Jg3q_1XEy1Ig-JzfECk")
File "/Library/Python/2.7/site-packages/gdata/spreadsheet/service.py", line 129, in GetWorksheetsFeed
converter=gdata.spreadsheet.SpreadsheetsWorksheetsFeedFromString)
File "/Library/Python/2.7/site-packages/gdata/service.py", line 1069, in Get
headers=extra_headers)
File "/Library/Python/2.7/site-packages/atom/init.py", line 93, in optional_warn_function
return f(_args, *_kwargs)
File "/Library/Python/2.7/site-packages/atom/service.py", line 186, in request
data=data, headers=all_headers)
File "/Library/Python/2.7/site-packages/atom/http_interface.py", line 148, in perform_request
return http_client.request(operation, url, data=data, headers=headers)
TypeError: new_request() takes exactly 1 argument (4 given)
Here's my complete source code
import gdata.spreadsheet.service
import gdata.service
import gdata.spreadsheet
import gdata.gauth
from oauth2client.client import SignedJwtAssertionCredentials
import httplib2
credentials = SignedJwtAssertionCredentials(
"[email protected]",
open("secret.p12").read(),
scope=(
"https://www.googleapis.com/auth/drive",
"https://spreadsheets.google.com/feeds",
"https://docs.google.com/feeds"
), # For example.
sub="[email protected]"
)
http = httplib2.Http()
http = credentials.authorize(http)
auth2token = gdata.gauth.OAuth2TokenFromCredentials(credentials)
gd_client = gdata.spreadsheet.service.SpreadsheetsService() # For example.
gd_client = auth2token.authorize(gd_client)
feed = gd_client.GetWorksheetsFeed("MY_DOC_ID")
Any idea how to fix it? I googled it online and found no working solution so far.
It would be nice to update the examples so it can work again.
Thanks!
support for " webmaster-tools/v3/searchanalytics/query "
Hello,
i've seen an updated page here "https://developers.google.com/webmaster-tools/v3/" mentioning
"Search Analytics" but unfortunately the python library does allow to access this new feature in the API.
POST /sites/siteUrl/searchAnalytics/query
anyone knows if this will be implemented soon or later?
thanks
Authentication doesn't work: Login Error
I have a site at http://sites.google.com/site/sergroj/
I tried the following steps:
- Copied https://github.com/google/gdata-python-client/blob/master/samples/sites/sites_example.py to gdata-python-client-master\src\
- Run c:\Python27\python.exe sites_example.py
- Left the Google Apps input empty
- Entered "sergroj" as site name
- Chose 1 (login/password) as authentication method
- Entered login/password. Tried both "sergroj" and "[email protected]".
The result is "Login Error".
Bug GetContactsFeed?
I was could not get contacts from service "Google Contacts".
But I found the solution on the Internet:
http://pbxinaflash.com/community/index.php?threads/google-contacts-to-asterisk-phonebook.10943/page-2#post-95132
Thank you for attention!
My code as example:
# encoding: utf-8
import gdata.contacts.service
GOOGLE_EMAIL = '[email protected]'
GOOGLE_PASSWORD = 'mypassword'
client = gdata.contacts.service.ContactsService()
client.ClientLogin(GOOGLE_EMAIL, GOOGLE_PASSWORD)
feed = client.GetContactsFeed()
InsertPhotoSimple - [Errno 32] Broken Pipe
I am using TouchSelfie to create a simple photobooth. It should allow me to upload photos to a Google photos album, and was working yesterday. Today the uploading feature seemed to stop.
I can query my photo albums successfully using the following example code:
photos = client.GetFeed(album_url)
for photo in photos.entry:
print 'Photo title:', photo.title.text
Since the photos in that album get printed, I presume my credentials are working fine.
But if I try to upload a photo using the InsertPhotoSimple
function I get error: [Errno 32] Broken pipe
The InsertPhotoSimple code I am using is straight from the API Documentation
client.InsertPhotoSimple(album_url, 'Test Photo', 'Testing API', "myphoto.png", content_type='image/png')
I can't figure it out what happened! My codebase didn't change, but now I am getting errors. Any help is appreciated!
The full stack trace:
client.InsertPhotoSimple(album_url, 'AYYY', 'Test API', "logo.png", content_type='image/png')
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-72-ffbac228ff15> in <module>()
----> 1 client.InsertPhotoSimple(album_url, 'AYYY', 'Test API', "logo.png", content_type='image/png')
/usr/lib/python2.7/dist-packages/gdata/photos/service.pyc in InsertPhotoSimple(self, album_or_uri, title, summary, filename_or_handle, content_type, keywords)
468 metadata.media.keywords = gdata.media.Keywords(text=keywords)
469 return self.InsertPhoto(album_or_uri, metadata, filename_or_handle,
--> 470 content_type)
471
472 def UpdatePhotoMetadata(self, photo):
/usr/lib/python2.7/dist-packages/gdata/photos/service.pyc in InsertPhoto(self, album_or_uri, photo, filename_or_handle, content_type)
424 try:
425 return self.Post(photo, uri=feed_uri, media_source=mediasource,
--> 426 converter=gdata.photos.PhotoEntryFromString)
427 except gdata.service.RequestError, e:
428 raise GooglePhotosException(e.args[0])
/usr/lib/python2.7/dist-packages/gdata/service.pyc in Post(self, data, uri, extra_headers, url_params, escape_params, redirects_remaining, media_source, converter)
1233 extra_headers=extra_headers, url_params=url_params,
1234 escape_params=escape_params, redirects_remaining=redirects_remaining,
-> 1235 media_source=media_source, converter=converter)
1236
1237 def PostOrPut(self, verb, data, uri, extra_headers=None, url_params=None,
/usr/lib/python2.7/dist-packages/gdata/service.pyc in PostOrPut(self, verb, data, uri, extra_headers, url_params, escape_params, redirects_remaining, media_source, converter)
1300 server_response = self.request(verb, uri,
1301 data=[multipart[0], data_str, multipart[1], media_source.file_handle,
-> 1302 multipart[2]], headers=extra_headers, url_params=url_params)
1303 result_body = server_response.read()
1304
/usr/lib/python2.7/dist-packages/atom/__init__.pyc in optional_warn_function(*args, **kwargs)
90 if ENABLE_V1_WARNINGS:
91 warnings.warn(warning, DeprecationWarning, stacklevel=2)
---> 92 return f(*args, **kwargs)
93 # Preserve the original name to avoid masking all decorated functions as
94 # 'deprecated_function'
/usr/lib/python2.7/dist-packages/atom/service.pyc in request(self, operation, url, data, headers, url_params)
183 auth_token = self.token_store.find_token(url)
184 return auth_token.perform_request(self.http_client, operation, url,
--> 185 data=data, headers=all_headers)
186
187 request = atom.v1_deprecated(
/usr/lib/python2.7/dist-packages/atom/http_interface.pyc in perform_request(self, http_client, operation, url, data, headers)
146 headers=None):
147 """For the GenericToken, no Authorization token is set."""
--> 148 return http_client.request(operation, url, data=data, headers=headers)
149
150 def valid_for_scope(self, url):
/usr/lib/python2.7/dist-packages/atom/http.pyc in request(self, operation, url, data, headers)
167 if isinstance(data, list):
168 for data_part in data:
--> 169 _send_data_part(data_part, connection)
170 else:
171 _send_data_part(data, connection)
/usr/lib/python2.7/dist-packages/atom/http.pyc in _send_data_part(data, connection)
353 binarydata = data.read(100000)
354 if binarydata == '': break
--> 355 connection.send(binarydata)
356 return
357 else:
/usr/lib/python2.7/httplib.pyc in send(self, data)
853 datablock = data.read(blocksize)
854 else:
--> 855 self.sock.sendall(data)
856
857 def _output(self, s):
/usr/lib/python2.7/ssl.pyc in sendall(self, data, flags)
699 count = 0
700 while (count < amount):
--> 701 v = self.send(data[count:])
702 count += v
703 return amount
/usr/lib/python2.7/ssl.pyc in send(self, data, flags)
665 self.__class__)
666 try:
--> 667 v = self._sslobj.write(data)
668 except SSLError as x:
669 if x.args[0] == SSL_ERROR_WANT_READ:
error: [Errno 32] Broken pipe
Is gdata.projecthosting actually discontinued or supported and working?
Hello,
it seems the URLs
https://code.google.com/feeds/issues/p/PROJECTNAME/issues/full
https://code.google.com/feeds/issues/p/PROJECTNAME/issues/123/comments/full
are dead (and maybe others are, too). If I do not misunderstand this code, this breakes the projecthosting submodule.
Is this just a temporary issue or is this module really not supported any more? In the latter case: So, googlecode is closing, but there is no supported way to export the complete issue data? Really? I have to parse the HTML of the Website myself...? If it is indeed unsupported please remove it, remove the misleading testcase and update the readme, so that other people do not have to waste their time finding out what's wrong with that module.
thanks.
Plans to tag a release, and/or send to pypi?
Hello,
The latest pyp release as of today is 2.0.18 from 2013-06-14
https://pypi.python.org/pypi/gdata, which points back to the dead google code repo.
Also, the 2.0.18 release doesn't work with the April 2014 release of Google Sheets.
Side note: I made a patched version that does work.
https://code.google.com/r/ed-new-google-sheets-support/
Since all the new development is happening here, it would be great to, tag a release in github at some time that works with:
new April 2014 Google Sheets
oauth2
Is the current head suitable to tag as a release?
Thanks,
Ed
Opt-out
EmailSettings not working with oauth2 ?
service_account_mail = '[email protected]'
service_account_client_id = 'xxxxxx.apps.googleusercontent.com'
with open("private_key.p12") as f:
private_key = f.read()
gapps_scope=[
'https://www.googleapis.com/auth/drive',
'https://apps-apis.google.com/a/feeds/emailsettings/2.0/',
]
credentials = SignedJwtAssertionCredentials(service_account_mail, private_key, gapps_scope)
print credentials.access_token
None
credentials.get_access_token()
credentials.access_token
Now I get something useful
headers = {
'Authorization': 'Bearer ' + credentials.access_token,
'Content-type': 'application/atom+xml'
}
url_tpl = """https://apps-apis.google.com/a/feeds/emailsettings/2.0/mydomain.com/%s/%s"""
url = url_tpl % (myusername, 'label')
r = requests.get(url, headers=headers)
403 - 'You are not authorized to access this API.'
body_tpl = """<?xml version="1.0" encoding="utf-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:apps="http://schemas.google.com/apps/2006">
<apps:property name="signature" value="%s" />
</atom:entry>"""
url = url_tpl % (myusername, 'signature')
payload = body_tpl % 'Test'
r = requests.put(url, headers=headers, data=payload)
403 - 'You are not authorized to access this API.'
r = requests.get(url, headers=headers)
403 - 'You are not authorized to access this API.'
drive_url = "https://www.googleapis.com/drive/v2/files"
headers = { 'Authorization': 'Bearer ' + credentials.access_token, }
r = requests.get(drive_url, headers=headers)
200 - 'OK'
Also tried :
EmailSettingsClient + AuthSubToken,
EmailSettingsClient + client.auth_token override,
EmailSettingsClient + HttpRequest(headers=additional_headers),
EmailSettingsClient + OAuth2TokenFromCredentials(credentials).authorize
Could someone else confirm it works (by actually trying, please)
and maybe explain what I'm doing wrong here ?
Many thanks.
Youtube Support
Hi .. just checking if youtube support via this library is now deprecated due to the API changes to v3? I had an email saying I need to migrate to v3 but I cannot find anything about this in regards to using gdata with python.
Someone posted a link on stackoverflow to a java library saying it is deprecated: https://code.google.com/p/gdata-java-client/
If so might be worth mentioning this somewhere prominent.
Thanks.
Try installing gdata with the following command,
Try installing gdata with the following command,
pip install gdata-python3
Originally posted by @eldhoshaji in #65 (comment)
WORK! THKS!
The DeleteRow function results in the deletion of every other row when iterating through a ListFeed in a spreadsheet using python gdata in New Google Spreadsheets
I am having a problem using the DeleteRow function in New Google Spreadsheets.
I have prepared a NEW google spreadsheet and entered multiple rows of data into the worksheet. For example, I put the following in column A, each on its own row: ID, 1,2,3,4,5,6,7,8,9,10,11,12
Then I perform deleterow() in a loop over a ListFeed as follows:
import gdata.spreadsheet.service
import gdata.service
ss_key = “google spreadsheet key";
gd_client = gdata.spreadsheet.service.SpreadsheetsService();
...
gd_client.ProgrammaticLogin();
feed = gd_client.GetWorksheetsFeed(ss_key);
worksheetID = feed.entry[int(feed.total_results.text)-1].id.text.rsplit('/', 1)[1]
listFeed = gd_client.GetListFeed(ss_key, worksheetID);
for row in listFeed.entry:
gd_client.DeleteRow(row)
The expected output would be for the rows except the header to be deleted. What I see is that rows 2,4,6,8,10 and 12 remain. If I run it again, rows 4,8,12 remain. It is deleting every other row.
I am using gdata 2.0.18 and new google spreadsheets
This approach continues to work the old google spreadsheets. It does not work with the new google spreadsheets.
Trying to install the google data library, running into syntax errors
I downloaded the library from github, unpacked the zip, navigated to the directory of the folder in command prompt on Windows, and ran setup.py install. I got multiple syntax errors and print errors saying the code was missing parentheses. How do I install this properly? How can I change my setup so that I can run code without needing parentheses in print statements? Thanks
Could not use AuditService.
Hi.
I want to download entire mailbox of a user.
My code is this:
my_domain = "test.com"
dest_user = '[email protected]'
client = gdata.apps.audit.service.AuditService(domain=my_domain)
scope = ['https://apps-apis.google.com/a/feeds/compliance/audit/']
credentials = ServiceAccountCredentials.from_json_keyfile_name('my_credential.json', scopes=scope)
http = credentials.authorize(httplib2.Http())
client.createMailboxExportRequest(dest_user)
But it says that I need authorization.
I have spared 2 days to find a sample code of oAuth2 authentication, but failed.
All samples are used ClientLogin
function which is already removed last year.
I will be very appreciated if anyone could help me.
Thanks.
Error 404 accessing Drive API
Appears Google's API services are down. Not sure where to report this. Began shortly after 11am PST.
gdata.service.RequestError: {'status': 404, 'body': '<!DOCTYPE html><html lang="en" ><head><meta name="description" content="Web word processing, presentations and spreadsheets"><link rel="shortcut icon" href="//ssl.gstatic.com/docs/common/drive_favicon1.ico"><title>Google Drive -- Page Not Found</title><link href="//fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet" type="text/css"><style>/* Copyright 2015 Google Inc. All Rights Reserved. */\n.goog-inline-block{position:relative;display:-moz-inline-box;display:inline-block}* html .goog-inline-block{display:inline}*:first-child+html .goog-inline-block{display:inline}#drive-logo{color:#91959c;font-family:"Open Sans",Arial,sans-serif;font-size:27px;font-weight:300;position:absolute;text-shadow:0 1px 1px white;white-space:nowrap}#drive-logo img{padding:0 0.4em 0 0;position:relative;top:2px;vertical-align:middle}#drive-logo a{color:#91959c;text-decoration:none}#drive-logo span.goog-inline-block{margin-top:2px;vertical-align:top}</style><style type="text/css">body {background-color: #fff; font-family: Arial,sans-serif; font-size: 13px; margin: 0; padding: 0;}a, a:link, a:visited {color: #112ABB;}</style><style type="text/css">.errorMessage {font-size: 12pt; font-weight: bold; line-height: 150%;}</style></head><body><div style="margin: auto; max-width: 750px;"><div style="margin: 80px 40px 20px 40px; position:relative; "><div style="position: absolute; top: -80px;"><h1 id="drive-logo"><a href="/"><img src="//www.google.com/images/logos/google_logo_41.png" width="116" height="41" alt="Google logo" ><span class="goog-inline-block">Drive</span></a></h1></div><div align="center"><p class="errorMessage" style="padding-top: 50px">Sorry, the file you have requested does not exist.</p><p> Please check the address and try again. </p><div style="background: #F0F6FF; border: 1px solid black; margin-top: 35px; padding: 10px 125px; width: 300px;"><p><strong>Get stuff done with Google Drive</strong></p><p>Apps in Google Drive make it easy to create, store and share online documents, spreadsheets, presentations and more.</p><p>Learn more at <a href="https://drive.google.com/start/apps">drive.google.com/start/apps</a>.</p></div></div></div></div></body></html>', 'reason': 'Not Found'}
Embedded PyCrypto version has several vulnerabilities
Gdata-python-client currently has a bundled copy of PyCrypto v2.0.1 (in src/gdata/Crypto/
). But the website says:
- In versions prior to v2.6.1, Crypto.Random was insecure when using fork() in some cases. See the advisory for CVE-2013-1445 for more information. It is recommended that users upgrade to PyCrypto v2.6.1 or later.
- In versions prior to v2.1.0, Crypto.Util.randpool.RandomPool was unsafe as commonly used. It was not thread-safe or fork-safe at all, and it was not always properly seeded with entropy. This was by design, but most application developers simply read from it without any further thought, resulting in insecure applications. See this thread for more information. It is now is deprecated, and will be removed in a future release; Use Crypto.Random or os.urandom instead.
There were also other vulnerabilities found, like CVE-2012-05-25 (insecure ElGamal key generation).
As PyCrypto is security-sensitive software, I think the best thing can be removing it from the Git/tarballs and tell users to use the version from PyPI instead.
auth.py uses bytearray.tostring, which doesn't seem to exist
auth.py
uses tostring
in exactly 1 place, which causes the following test to fail for me:
ERROR: testSecureAuthSubGetAuthHeader (gdata_tests.auth_test.TokenClassesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/ccalabro/code/python/gdata-python-client/tests/gdata_tests/auth_test.py", line 514, in testSecureAuthSubGetAuthHeader
auth_header = token.GetAuthHeader('GET', url)
File "/Library/Python/2.7/site-packages/gdata/auth.py", line 943, in GetAuthHeader
sig = encodestring(self.rsa_key.hashAndSign(data).tostring()).rstrip()
AttributeError: 'bytearray' object has no attribute 'tostring'
The output of hashAndSign
is a bytearray
(for me it is anyway, is it not for the author?), which doesn't have a tostring
method, at least, it doesn't in python 2.7.1, which INSTALL.txt
claims this project supports. Actually, I can't find any version of python where bytearray
has a tostring
method. Why not just use str(self.rsa_key.hashAndSign(data))
instead?
I believe this bug was introduced by commit 3c85d33.
Google Contacts samples are FOUR YEARS out of date (using OAuth V1)
While trying to learn how to use the Google Contacts API from python, I followed links from here:
https://developers.google.com/google-apps/contacts/v3/?csw=1#running_the_sample_code
...to this repo.
I worked out that gdata requires TLS Lite, and that TLS Lite needs m2crypto to stop it from erroring. However, having cleared all those hurdles, I found that your sample scripts are using OAuth V1 which YOU deprecated FOUR years ago!!! ....the four years is according to this page:
https://developers.google.com/identity/protocols/AuthForInstalledApps
Important: ClientLogin has been officially deprecated since April 20, 2012 and is now no longer available. Requests to ClientLogin will fail with a HTTP 404 response. We encourage you to migrate to OAuth 2.0 as soon as possible.
Please follow you own advice and upgrade the sample scripts to OAuth 2.0 as soon as possible.
Thank you =)
Documentation about ClientLogin deprecation and resulting errors
Most of the samples - definitely the Spreadsheets one - use ClientLogin which is now deprecated. This is certainly causing confusion among people who don't closely follow the API status (i.e. see ?place=topic%2Fgoogle-spreadsheets-api%2FgmZHNh5cR80%2Fdiscussion and https://code.google.com/p/gdata-python-client/issues/detail?id=719&sort=-opened&colspec=Opened%20Stars%20ID%20Type%20Status%20Priority%20Component%20Summary )
It would be very helpful if the samples were updated, or the ClientLogin methods were changed to throw a deprecation error, or at least there was a clear comment in the documentation.
Update required due to deprecation of Document List
Code depending on https://docs.google.com/feeds/, https://docs.googleusercontent.com/ and
https://spreadsheets.google.com/feeds/ need to be updated according to https://developers.google.com/drive/web/migration.
client.py get_oauth_token() raises exception on 301 response
https://github.com/google/gdata-python-client/blob/master/src/gdata/client.py#L577
Google is returning a 301 response (Moved Temporarily) aka Redirect. The get_oauth_token code treats anything other than 200 as an error, and does not follow the redirect, thus authentication is broken.
ImportError: No module named tlslite.utils
import gdata.spreadsheet.service
import sys
import string
import json
with open("GoogleAppPw.json") as fh:
config = json.load(fh)
client = gdata.spreadsheet.service.SpreadsheetsService()
client.ClientLogin(config['email'], config['password'])
##############OUTPUT
Traceback (most recent call last):
File "addcolumn.py", line 1, in
import gdata.spreadsheet.service
File "/Library/Python/2.7/site-packages/gdata/spreadsheet/service.py", line 32, in
import gdata.service
File "/Library/Python/2.7/site-packages/gdata/service.py", line 80, in
import gdata.auth
File "/Library/Python/2.7/site-packages/gdata/auth.py", line 29, in
import gdata.oauth.rsa as oauth_rsa
File "/Library/Python/2.7/site-packages/gdata/oauth/rsa.py", line 10, in
from tlslite.utils import keyfactory
ImportError: No module named tlslite.utils
Reference Guide link is broken
Not sure if this is the right place to submit this issue. On the online API doc fro Picassa, (https://developers.google.com/picasa-web/code#python-client-library-v10) the reference guid link -Reference Guide (PyDoc)- points to a broken link: http://gdata-python-client.googlecode.com/hg/pydocs/
Sorry if this is not the right place, couldn't figure out how to give feedback on the same doc page.
Facing issue when create shared contacts - AttributeError
SitesFeedSummary example doesn't work
Here is output:
/home/stas/env/wmt_scrapper/bin/python /home/stas/PycharmProjects/wmt_scrapper/gdata-python-client/samples/webmastertools/SitesFeedSummary.py
Please enter your username: ****
/usr/lib/python2.7/getpass.py:83: GetPassWarning: Can not control echo on the terminal.
passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
Password: ****
Logging in
Retrieving Sites feed
Traceback (most recent call last):
File "/home/stas/PycharmProjects/wmt_scrapper/gdata-python-client/samples/webmastertools/SitesFeedSummary.py", line 42, in <module>
feed = client.GetSitesFeed()
File "/home/stas/env/wmt_scrapper/local/lib/python2.7/site-packages/gdata/webmastertools/service.py", line 85, in GetSitesFeed
return self.Get(uri, converter=converter)
File "/home/stas/env/wmt_scrapper/local/lib/python2.7/site-packages/gdata/service.py", line 1107, in Get
'reason': server_response.reason, 'body': result_body}
gdata.service.RequestError: {'status': 401, 'body': '<HTML>\n<HEAD>\n<TITLE>Authorization required</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Authorization required</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': 'Authorization required'}
Also, when I try to use oauth authentication I also get's error:
#-*- coding: utf-8 -*-
from wmt_scrapper.google_api import GoogleApi
__author__ = 'stas'
import gdata.webmastertools.service
client = gdata.webmastertools.service.GWebmasterToolsService()
def request(*a, **k):
stream = client.request(*a, **k)
out = stream.read()
stream.close()
return out
gapi = GoogleApi()
gapi.credentials.authorize(client)
print request('GET', "https://www.google.com/webmasters/tools/gwt/SITE_LIST?hl=en&authuser=1")
returns
Traceback (most recent call last):
File "/home/stas/PycharmProjects/wmt_scrapper/gwtd/test.py", line 21, in <module>
print request('GET', "https://www.google.com/webmasters/tools/gwt/SITE_LIST?hl=en&authuser=1")
File "/home/stas/PycharmProjects/wmt_scrapper/gwtd/test.py", line 11, in request
stream = client.request(*a, **k)
File "/home/stas/env/wmt_scrapper/local/lib/python2.7/site-packages/oauth2client/client.py", line 562, in new_request
redirections, connection_type)
File "/home/stas/env/wmt_scrapper/local/lib/python2.7/site-packages/atom/__init__.py", line 92, in optional_warn_function
return f(*args, **kwargs)
TypeError: request() takes at most 6 arguments (7 given)
Error under python3.4
Error in python3.4:
>>> import atom.http_core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/alex/dev/other/django_env3/lib/python3.4/site-packages/atom/__init__.py", line 133, in <module>
CreateClassFromXMLString)
File "/home/alex/dev/other/django_env3/lib/python3.4/site-packages/atom/__init__.py", line 97, in mark_deprecated
optional_warn_function.func_name = f.func_name
AttributeError: 'function' object has no attribute 'func_name'
Support for v3 of Google Calendar API?
Hi There,
It seems that Google has deprecated v2 of the Calendar API. Any plans on implementing v3?
testRecordResponse (atom_tests.mock_http_test.MockHttpClientUnitTest) ... FAIL
Hello,
I just cloned and installed, but a single testcase fails (Python version is 2.7.5+), all others pass.
Is there something not uptodate maybe? It seems that it queries
http://www.google.com/base/feeds/snippets?max-results=1
which does not exist.
======================================================================
FAIL: testRecordResponse (atom_tests.mock_http_test.MockHttpClientUnitTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/path/to/gdata-python-client/tests/atom_tests/mock_http_test.py", line 49, in testRecordResponse
self.assertEquals(live_response.status, 200)
AssertionError: 404 != 200
cheers
A lot of syntax errors in exception handling and "print" syntax
Hello,
I am new here and downloaded this lib today.
During installing there were a lot of syntax errors found in exception raising. And there were some mistakes in some "print" callings...
Now I have version of files with now error during setup. I am not sure if I corrected all errors right according the lines meaning...
So any body interested to look and check my corrections?
Petr
The DeleteRow function results in the deletion of every other row when iterating through a ListFeed in a spreadsheet using python gdata in New Google Spreadsheets
What steps will reproduce the problem?
- Prepare two NEW google spreadsheets, “input". Enter multiple rows of data into the worksheet. For example, put the following in column A, each on its own row: ID, 1,2,3,4,5,6,7,8,9,10,11,12
- Perform deleterow() in a loop over a ListFeed
import gdata.spreadsheet.service
import gdata.service
ss_key = “google spreadsheet key";
gd_client = gdata.spreadsheet.service.SpreadsheetsService();
...
gd_client.ProgrammaticLogin();
feed = gd_client.GetWorksheetsFeed(ss_key);
worksheetID = feed.entry[int(feed.total_results.text)-1].id.text.rsplit('/', 1)[1]
listFeed = gd_client.GetListFeed(ss_key, worksheetID);
for row in listFeed.entry:
gd_client.DeleteRow(row)
What is the expected output? What do you see instead?
Expected output would be for the rows except the header to be deleted. What I see is that rows 2,4,6,8,10 and 12 remain. If I run it again, rows 4,8,12 remain. It is deleting every other row.
What version of the product are you using?
gdata 2.0.18 and new google spreadsheets
Please provide any additional information below.
This approach continues to work the old google spreadsheets. It does not work with the new google spreadsheets.
tests fail, referring to nonexistent 'finance' and 'notebook' modules
For example:
➜ gdata-python-client git:(master) ✗ PYTHONPATH=`pwd`/src python tests/all_tests_local.py
Traceback (most recent call last):
File "tests/all_tests_local.py", line 25, in <module>
import all_tests
File "/Users/wlowe/code/gdata-python-client/tests/all_tests.py", line 34, in <module>
import gdata_tests.data_smoke_test
File "/Users/wlowe/code/gdata-python-client/tests/gdata_tests/data_smoke_test.py", line 33, in <module>
import gdata.notebook.data
ImportError: No module named notebook.data
There is in fact no module at src/gdata/notebook/
import gdata not work
import gdata
Traceback (most recent call last):
File "", line 1, in
import gdata
File "C:\ProgramData\Anaconda2\lib\site-packages\gdata_init_.py", line 108, in
class LinkFinder(atom.LinkFinder):
AttributeError: 'module' object has no attribute 'LinkFinder'
when i try to import gdata this is the error
``gdata`` package should not be installing ``atom`` module
The atom
package belongs to somebody else: https://pypi.python.org/pypi/atom/0.3.10
Therefore gdata
should not install files under the atom
package.
Error message optional_warn_function.func_name = f.func_name AttributeError: 'function' object has no attribute 'func_name'
From @idesignedme on July 27, 2016 2:11
I am trying to use the google client api for python 3.5 but only 3.4 is supported I keep getting the error messag
optional_warn_function.func_name = f.func_name
AttributeError: 'function' object has no attribute 'func_name'
is there a work around or will the version compatible with 3.5 be coming out soon ?
Copied from original issue: googleapis/google-api-python-client#254
Test failed:
FAIL: testRecordResponse (atom_tests.mock_http_test.MockHttpClientUnitTest)
Traceback (most recent call last):
File "/home/titovanton/gdata-python-client/tests/atom_tests/mock_http_test.py", line 49, in testRecordResponse
self.assertEquals(live_response.status, 200)
AssertionError: 404 != 200
Ran 3 tests in 0.879s
FAILED (failures=1)
Traceback (most recent call last):
File "tests/run_data_tests.py", line 57, in
RunAllTests()
File "tests/run_data_tests.py", line 54, in RunAllTests
test_runner.RunAllTests()
File "/home/titovanton/gdata-python-client/tests/module_test_runner.py", line 58, in RunAllTests
raise Exception('Tests failed!')
Exception: Tests failed!
spreadsheet InsertRow questions
Hello, I wanted to ask if it's possible to (a)specify where to insert row in a spreadsheet instead of just appending at the end(b) specify the format of the cells. I basically want the new cells inserted to have the same format as the cell above them.
I looked at the code here and it seems it uses the POST function here to insert a row:
https://github.com/google/gdata-python-client/blob/79d2d3c8a26662943fcbff11ec29732ad92bbf8b/src/gdata/service.py
Is it possible to insert somewhere not at the end? And also to specify the formatting? Thanks :) Apologies is posting at a wrong place, will move it if necessary.
def InsertRow(self, row_data, key, wksht_id='default'):
"""Inserts a new row with the provided data
Args:
uri: string The post uri of the list feed
row_data: dict A dictionary of column header to row data
Returns:
The inserted row
"""
new_entry = gdata.spreadsheet.SpreadsheetsList()
for k, v in row_data.iteritems():
new_custom = gdata.spreadsheet.Custom()
new_custom.column = k
new_custom.text = v
new_entry.custom[new_custom.column] = new_custom
# Generate the post URL for the worksheet which will receive the new entry.
post_url = 'https://spreadsheets.google.com/feeds/list/%s/%s/private/full'%(
key, wksht_id)
return self.Post(new_entry, post_url,
converter=gdata.spreadsheet.SpreadsheetsListFromString)
Youtube data api'youtube.search.list()' returning handshake error
I'm invoking youtube data api "youtube.search.list()" to retrieve channel ids for a company name.
API returns data for about 3000 requests.After 3000 requests,I'm getting a handshake error.Below is the full stack trace.
File "/home/ubuntu/jenkins/workspace/youtube_data_collection/MyPy/local/lib/python2.7/site-packages/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/ubuntu/jenkins/workspace/youtube_data_collection/MyPy/local/lib/python2.7/site-packages/googleapiclient/http.py", line 835, in execute
method=str(self.method), body=self.body, headers=self.headers)
File "/home/ubuntu/jenkins/workspace/youtube_data_collection/MyPy/local/lib/python2.7/site-packages/googleapiclient/http.py", line 175, in _retry_request
raise exception
SSLError: _ssl.c:495: The handshake operation timed out
Can you please help me in setting a correct timeout period while making calls via youtube data api?
large file download fails with OverflowError
Files in Google Drive which are more than 2GB fail to download on my 32 bit Linux machine.
$ python gdata-get.py
Traceback (most recent call last):
File "gdata-get.py", line 129, in
g._get('bigvid.avi', '/mnt/bigstore/tmp/testbigdownload.avi')
File "gdata-get.py", line 79, in _get
self.client.DownloadResource(entry, local_path) #.name)
File "/usr/local/lib/python2.7/dist-packages/gdata/docs/client.py", line 369, in download_resource
self._download_file(uri, file_path, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/gdata/docs/client.py", line 468, in _download_file
f.write(self._get_content(uri, *_kwargs))
File "/usr/local/lib/python2.7/dist-packages/gdata/docs/client.py", line 451, in _get_content
return server_response.read()
File "/usr/lib/python2.7/httplib.py", line 541, in read
return self._read_chunked(amt)
File "/usr/lib/python2.7/httplib.py", line 624, in _read_chunked
return ''.join(value)
OverflowError: join() result is too long for a Python string
This issue came to light when I was using duplicity; the script gdata-get.py is a simplified version of some code from duplicity. To exhibit the issue, I first uploaded a large video (2,792,304,612 bytes) to /test-gdata/bigvid.avi in Google Drive, and added the appropriate authentication strings to line 49 of gdata-get.py. The destination filename in the final line should also be edited.
I have pastebinned gdata-get.py here: http://pastebin.com/mFK8TQiG
Version info:
$ pip search gdata|grep INSTALLED
INSTALLED: 2.0.18 (latest)
$ apt-cache policy python|grep Installed
Installed: 2.7.3-0ubuntu2.2
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"
install_requires unknown distribution option.
~/gdata-python-client$ sudo python setup.py install
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
Google Feed sometimes provides 0 length, empty response with http status 200, resulting in traceback
I am using the current master and python2.7. I seem to occasionally hit a repeatable bug with Google's Feed providing a 0 content length, empty response, but with a 200 http status code. For example, this feed is currently doing it.
This results in python traceback
Traceback (most recent call last):
File "playground.py", line 12, in <module>
print sprclient.GetWorksheets('1UeEJ0rTQaP0H2nidUDaNVu9D5Mw26BuaHInkAJnF6ms')
File "/home/akrherz/projects/gdata-python-client/src/gdata/spreadsheets/client.py", line 108, in get_worksheets
**kwargs)
File "/home/akrherz/projects/gdata-python-client/src/gdata/client.py", line 640, in get_feed
**kwargs)
File "/home/akrherz/projects/gdata-python-client/src/gdata/client.py", line 278, in request
version=get_xml_version(self.api_version))
File "/home/akrherz/projects/gdata-python-client/src/atom/core.py", line 520, in parse
tree = ElementTree.fromstring(xml_string)
File "<string>", line 125, in XML
cElementTree.ParseError: no element found: line 1, column 0
I attempted to print out the response headers (with some redaction) and here they are:
[('alternate-protocol', '443:quic,p=1'),
('content-length', '0'),
('x-xss-protection', '1; mode=block'),
('x-robots-tag', 'noindex, nofollow, nosnippet'),
('x-content-type-options', 'nosniff'),
('set-cookie', 'NID=76=1....;Domain=.google.com;Path=/;Expires=Thu, 25-Aug-2016 05:17:40 GMT;HttpOnly, NID=76=V...w;Domain=.google.com;Path=/;Expires=Thu, 25-Aug-2016 05:17:40 GMT;HttpOnly'),
('expires', 'Wed, 24 Feb 2016 05:17:40 GMT'),
('server', 'GSE'),
('cache-control', 'private, max-age=0'),
('date', 'Wed, 24 Feb 2016 05:17:40 GMT'),
('p3p', 'CP="This is not a P3P policy! See https://support.google.com/accounts/answer/151657?hl=en for more info.", CP="This is not a P3P policy! See https://support.google.com/accounts/answer/151657?hl=en for more info."'),
('alt-svc', 'quic=":443"; ma=2592000; v="30,29,28,27,26,25"'),
('content-type', 'application/binary'),
('x-frame-options', 'SAMEORIGIN')]
I can request other feeds just fine and I can request this feed in my web browser just fine as well. So I am a bit puzzled. Thanks
]]b .+*/. ll//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Mark this library as 'not maintained'
Seems like a lot of people are still landing upon this library and expecting it to be maintained.
An example is:
Google Search: google photos api -> picasa api -> docs that point to gdata
It would be helpful to put the status of this repo into the README.md so people use clients that are (https://github.com/google/google-api-python-client).
Sites example uri invalid syntax
In sites_example.py, there is a syntax issue with the uri at line 297.
λ py sites_example.py
File "sites_example.py", line 297
uri = ('%s?kind=%s' % (self.client.make_content_feed_uri(),
^
SyntaxError: invalid syntax
My terminal is interpreting this line as invalid syntax and I've tried wrapping it with parentheses but it still didn't work. I am not trying to be too invasive on this line but I need help this syntax error.
AttributeError: module 'atom' has no attribute 'LinkFinder'
import gdata.data
File "/usr/lib/python3.6/site-packages/gdata/init.py", line 109, in
class LinkFinder(atom.LinkFinder):
AttributeError: module 'atom' has no attribute 'LinkFinder'
same think if i install with:
pip3.6 install gdata-python3
Gdata and Google Docs API deprecation
How is the deprecation of the Google Docs API handled in this python client ?
No video upload to picasa/photos google
see carolinux/gdata-python-client#542
hack still works, but no normal way to upload a video to new photos google
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.