- pandas

PyScript - HTTP Requests pyfetch

from pyodide.http import pyfetch import asyncio import json import pandas as pd response = await pyfetch(url="https://services1.arcgis.com/79kfd2K6fskCAkyg/arcgis/rest/services/Louisville_Metro_KY_Expenditures_Data_For_Fiscal_Year_2022/FeatureServer/0/query?outFields=*&where=1%3D1&f=geojson", method="GET") output = f'{await response.json()}' str1 = output.replace("\'", "\"") str1 = str1.replace(" True", "\"True\"") str1 = str1.replace(" None", "\"None\"") st = json.loads(str1) df = pd.DataFrame.from_dict(st['features'][0:]) props = df["properties"][0] pyscript.write('request_output', props)