如何解析保存在 txt 中的 suds 对象?

How to parse suds object saved in txt?

我正在使用 Web of Science Python client,它与 suds 一起使用,但我几乎找不到任何有用的文档。我已经下载了超过 18k 个搜索结果(由于 API 的限制,这需要几个小时)并保存到文本文件中。现在我想解析它们。

要解析的示例文件:

(searchResults){
   queryId = "462"
   recordsFound = 1
   recordsSearched = 65470148
   records[] = 
      (liteRecord){
         uid = "WOS:000353665400007"
         title[] = 
            (labelValuesPair){
               label = "Title"
               value[] = 
                  "A New Perspective on Instantiation",
            },
         doctype[] = 
            (labelValuesPair){
               label = "Doctype"
               value[] = 
                  "Article",
            },
         source[] = 
            (labelValuesPair){
               label = "Issue"
               value[] = 
                  "3",
            },
            (labelValuesPair){
               label = "Pages"
               value[] = 
                  "448-463",
            },
            (labelValuesPair){
               label = "Published.BiblioDate"
               value[] = 
                  "WIN",
            },
            (labelValuesPair){
               label = "Published.BiblioYear"
               value[] = 
                  "2015",
            },
            (labelValuesPair){
               label = "SourceTitle"
               value[] = 
                  "LIBRARY TRENDS",
            },
            (labelValuesPair){
               label = "Volume"
               value[] = 
                  "63",
            },
         authors[] = 
            (labelValuesPair){
               label = "Authors"
               value[] = 
                  "Garbacz, Pawel",
            },
         other[] = 
            (labelValuesPair){
               label = "Identifier.Eissn"
               value[] = 
                  "1559-0682",
            },
            (labelValuesPair){
               label = "Identifier.Ids"
               value[] = 
                  "CG9UK",
            },
            (labelValuesPair){
               label = "Identifier.Issn"
               value[] = 
                  "0024-2594",
            },
            (labelValuesPair){
               label = "ResearcherID.Disclaimer"
               value[] = 
                  "ResearcherID data provided by Clarivate Analytics",
            },
      },
 }
  1. 如何将这些文件 "back" 解析为 python?
  2. 如果很难做到 - 如何将 suds 对象保存为 XML/JSON?

我用另一种方式解决了这个问题。

我刚刚创建了自己的 Web of Science Web Services 客户端,它可以打印出来 JSON。您可以在这里找到它:https://github.com/mdziezyc/WoSPythonClient