XML 从 API link Python 中提取数据

XML data extraction from an API link Python

我正在尝试抓取 API URL。我收到 XML 格式的响应。我熟悉 JSON's 响应,但它对我来说很陌生。我想知道我们如何继续使用 ScrapyRequestXML 响应中提取数据。什么类型的表达式用于定位某些值,例如 <FirmName><FirmId>(请到以下链接查看数据)

Link: https://www.ricsfirms.com/umbraco/api/surveyorSearchApi/results?location=United%20Kingdom&firmName=&lon=-5.2235136&lat=50.2307777&boxId=14821&country=GB&page=1

请尝试以下操作 returns JSON:

import requests

r = requests.get('https://www.ricsfirms.com/umbraco/api/surveyorSearchApi/results?location=United%20Kingdom&firmName=&lon=-5.2235136&lat=50.2307777&boxId=14821&country=GB&page=1')

data = r.json()

for office in data['resultOffices']:
    print(office['firmId'])
    print(office['firmName'])
    print('---')