使用suds对象

时间:2013-11-14 22:11:29

标签: python soap suds

我正在使用Web of Science API和suds来检索文章记录。我想创建一个包含所有不同ISSN的列表,但是我在suds对象中访问这些数据时遇到了问题。以下是一条记录的完整响应:

(searchResults){
   queryId = "1"
   recordsFound = 16922
   recordsSearched = 52057936
   records[] = 
      (liteRecord){
         uid = "WOS:000086498700003"
         title[] = 
            (labelValuesPair){
               label = "Title"
               value[] = 
                  "Why young people do not kill themselves: The Reasons for Living Inventory for Adolescents",
            },
         source[] = 
            (labelValuesPair){
               label = "Issue"
               value[] = 
                  "2",
            },
            (labelValuesPair){
               label = "Pages"
               value[] = 
                  "177-187",
            },
            (labelValuesPair){
               label = "Published.BiblioDate"
               value[] = 
                  "JUN",
            },
            (labelValuesPair){
               label = "Published.BiblioYear"
               value[] = 
                  "2000",
            },
            (labelValuesPair){
               label = "SourceTitle"
               value[] = 
                  "JOURNAL OF CLINICAL CHILD PSYCHOLOGY",
            },
            (labelValuesPair){
               label = "Volume"
               value[] = 
                  "29",
            },
         authors[] = 
            (labelValuesPair){
               label = "Authors"
               value[] = 
                  "Gutierrez, PM",
                  "Osman, A",
                  "Kopper, BA",
                  "Barrios, FX",
            },
         other[] = 
            (labelValuesPair){
               label = "Identifier.Ids"
               value[] = 
                  "304RV",
            },
            (labelValuesPair){
               label = "Identifier.Issn"
               value[] = 
                  "0047-228X",
            },
            (labelValuesPair){
               label = "Identifier.Xref_Doi"
               value[] = 
                  "10.1207/S15374424jccp2902_4",
            },
            (labelValuesPair){
               label = "ResearcherID.Disclaimer"
               value[] = 
                  "ResearcherID data provided by Thomson Reuters",
            },
      },
 }

我可以检索所有other列表,但我不确定如何通过标签识别和检索ISSN,以便我可以将其添加到列表中。给出的类型是:suds.sudsobject.labelValuePair。 IANAP并且对Python基本熟悉,所以我非常感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

这是一个选项:

soap = wos.WokmwsSoapClient()
results = soap.search(YOUR QUERY HERE)
for i in range(0, len(results.records[0].other)):
    if results.records[0].other[i]["label"] == "Identifier.Issn":
        print results.records[0].other[i]["value"][0]