2013-03-13 79 views
3

我试图编写一个python脚本,它从ISI Web of Science中检索有关出版物的信息。我在GitHub上找到了domoritz的python脚本wos.py。它使用Suds连接到ISI Web of Science Web服务。我已经导入到我的Python脚本,我尝试这种代码,下面的评论非常简要说明:通过SOAP访问ISI Web of Science

from wos import * 
soap = WokmwsSoapClient() 
results = soap.search('Hallam') 

然后我得到一个错误:

suds.WebFault: Server raised fault: 'line 1:1: unexpected token: Hallam' 

我通过代码看着wos.py.这里是search功能:

def search(self, query): 
    qparams = { 
     'databaseID' : 'WOS', 
     'userQuery' : query, 
     'queryLanguage' : 'en', 
     'editions' : [{ 
      'collection' : 'WOS', 
      'edition' : 'SCI', 
     },{ 
      'collection' : 'WOS', 
      'edition' : 'SSCI', 
     }] 
    } 

    rparams = { 
     'count' : 5, # 1-100 
     'firstRecord' : 1, 
     'fields' : [{ 
      'name' : 'Relevance', 
      'sort' : 'D', 
     }], 
    } 

    return self.client['search'].service.search(qparams, rparams) 

我想,也许query不能只是一个普通的Python字符串,正如我在WSDL页面看到userQuery实际上xs:string类型是。但是this pageuserQuery“必须是一个有效的WOKQL查询语句。这个要求是在内部强制执行的”,这看起来好像我不必传入特殊类型。无论如何,我试图追加'xs:string'到查询的开始,但我得到了同样的错误。

有没有人知道使用这种方法的正确方法?

+0

我也在学习如何访问知识数据网页。你知道发生了什么吗? http://stackoverflow.com/questions/15647236/soap-service-for-accessing-web-of-knowledge-using-php – DanielTheRocketMan 2013-03-26 21:07:27

+0

@Daniel对不起,不能帮助你!我对此很新。 – FrancesKR 2013-03-27 16:01:05

+0

谢谢!您是否需要获得任何额外的许可才能使用此系统访问知识网络? – DanielTheRocketMan 2013-03-27 17:19:55

回答

1

所以显然传入一个python字符串很好,但我需要一个更像搜索查询的字符串。我发现这个例子上the website我之前提到的:

<soap:Body> 
    <woksearch:search xmlns:woksearch="http://woksearch.v3.wokmws.thomsonreuters.com"> 
    <!-- this request has the minimum required elements, 
     but contains all valid retrieve options 
     for this operation and databaseId --> 
    <queryParameters> 
    <databaseId>WOK</databaseId> 
    <userQuery>AU=Arce, G*</userQuery>  
    <queryLanguage>en</queryLanguage> 
    </queryParameters> 
.... 

所以我尝试使用results = soap.search('AU=Hallam')和工作。我现在可以做像print results.recordsFound这样的事情,我可以得到正确答案。

+1

今天我得到这个错误: suds.WebFault:服务器引发的错误:'Web服务(版本2.0)已经永久退役。请联系汤森路透IP和科学技术支持http://ip-science.thomsonreuters.com/techsupport/了解如何获取我们Web服务的新版本。 – 2014-11-05 00:01:57

+0

Web服务版本2.0已被版本3.0替换。下面是说明:http://ipscience-help.thomsonreuters.com/wosWebServicesLite/WebServicesLiteOverviewGroup/Introduction/wsdlFileLocations.html – bdulac 2016-02-02 09:04:17

2

你可以尝试使用Wos Python Client可与被安装:

pip install wos 

然后你就可以使用它像这样:

from wos import WosClient 
import wos.utils 

with WosClient('JohnDoe', '12345') as client: 
    print(wos.utils.query(client, 'AU=Knuth Donald')) 

您也将有一个CLI工具使用像:

wos -u 'JohnDoe' -p '12345' query 'AU=Knuth Donald' 

免责声明:我是客户的作者。

+0

如果我运行'WOS -u '[email protected]' -p '输入mypassword' connect' ,我得到'错误:没有匹配返回用户名xxx @ xxx.org'。用户名称不是电子邮件地址吗? – jordix 2016-10-10 20:53:10

+0

@jordix我有同样的问题,你找到了解决方案吗? – 2017-01-20 08:46:24

+0

@patti_jane:由于Web of Science不允许来自普通用户的Web服务请求,因此您需要访问Web服务(这是一项付费服务​​)。你应该要求你的大学为你提供WOS给他们的用户名和密码。 – 2017-01-20 08:50:26