When I initiate a search on this website using this account number 0523620090003
, I can see relevant details concerning the account in the results. I’ve created a script using the requests module to scrape the two portions of the results: account details
and fiduciary
. I can already scrape the account details
located at the top left. However, I can’t parse the information related to Fiduciary, which is located in the middle of the right corner.
import requests
from pprint import pprint
link = 'https://arcweb.hcad.org/server/rest/services/public/public_query/MapServer/0/query'
params = {
'f': 'json',
'distance': 2,
'outFields': '*',
'outSR': '102100',
'spatialRel': 'esriSpatialRelIntersects',
'units': 'esriSRUnit_StatuteMile',
'where': "HCAD_NUM = '0523620090003'",
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36',
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9',
}
with requests.Session() as s:
s.headers.update(headers)
res = s.get(link,params=params)
pprint(res.json()['features'][0]['attributes'])
How can I scrape the fiduciary-related information from the website using the requests module?