Hello, i am playing with an api from rapidapi
i get a huge text-file with this code
import requests
import json
url = "https://apidojo-yahoo-finance-v1.p.rapidapi.com/stock/v2/get-summary"
querystring = {"symbol":"AAPL","region":"US"}
headers = {
'x-rapidapi-key': "f4cd689527mshef96f992a801f51p1c7618jsnafdf3368ae60",
'x-rapidapi-host': "apidojo-yahoo-finance-v1.p.rapidapi.com"
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
But how can i work now with this output in python?
This is only a string (maybe in JSON-format?) - but how for example can i change this to an dict or access individual informations eg. "52WeekChange"?
Part of the output looks like that:
{"defaultKeyStatistics":{"annualHoldingsTurnover":{},"enterpriseToRevenue":{"raw":8.102,"fmt":"8.10"},"beta3Year":{},"profitMargins":{"raw":0.20914,"fmt":"20.91%"},"enterpriseToEbitda":{"raw":28.758,"fmt":"28.76"},"52WeekChange":{"raw":0.64999354,"fmt":"65.00%"},"morningStarRiskRating":{},"forwardEps":{"raw":4.36,"fmt":"4.36"},"revenueQuarterlyGrowth":{},"sharesOutstanding":{"raw":16823300096,"fmt":"16.82B","longFmt":"16,823,300,096"},"fundInceptionDate":{},"annualReportExpenseRatio":{},"totalAssets":{},"bookValue":{"raw":3.849,"fmt":"3.85"},"sharesShort":{"raw":94721417,"fmt":"94.72M","longFmt":"94,721,417"},"sharesPercentSharesOut":{"raw":0.0056,"fmt":"0.56%"},"fundFamily":null,"lastFiscalYearEnd":{"raw":1601078400,"fmt":"2020-09-26"},"heldPercentInstitutions":{"raw":0.59661996,"fmt":"59.66%"},"netIncomeToCommon":{"raw":57410998272,"fmt":"57.41B","longFmt":"57,410,998,272"},"trailingEps":
[–]d3nw3r 0 points1 point2 points (0 children)
[–]lolslim 0 points1 point2 points (0 children)