使用gdata-python-client访问Google图书搜索数据API的SyntaxError [英] SyntaxError using gdata-python-client to access Google Book Search Data API

查看:105
本文介绍了使用gdata-python-client访问Google图书搜索数据API的SyntaxError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

>>> import gdata.books.service
>>> service = gdata.books.service.BookService()
>>> results = service.search_by_keyword(isbn='0434003484')
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
  results = service.search_by_keyword(isbn='0434003484')
... snip ...
File "C:\Python26\lib\site-packages\atom\__init__.py", line 127, in CreateClassFromXMLString
  tree = ElementTree.fromstring(xml_string)
File "<string>", line 85, in XML
SyntaxError: syntax error: line 1, column 0

这是一个最小的示例-特别是,包装中包括的图书服务单元测试也因完全相同的错误而失败.我查看了 Wiki,并在Google Code上打开了发行票证,无济于事(对我而言,这似乎更容易是一个愚蠢的错误,而不是库的问题).我不确定如何解释错误消息.如果重要的话,我使用的是python 2.6.5和最新版本的gdata,即2.0.10.

This is a minimal example -- in particular, the book service unit tests included in the package also fail with the exact same error. I've looked at the wiki and open issue tickets on Google Code to no avail (and this seems to me more apt to be a silly error on my end rather than a problem with the library). I'm not sure how to interpret the error message. If it matters, I'm using python 2.6.5 and the latest version of gdata, namely 2.0.10.

推荐答案

我发现我需要在gdata客户端中禁用SSL才能使其正常工作:

I found I needed to disable SSL in the gdata client for it to work:

...
gd_client.ProgrammaticLogin()
gd_client.ssl = False
...

这篇关于使用gdata-python-client访问Google图书搜索数据API的SyntaxError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆