I have this data coming via an api and I want to pull all the "confidence" scores that are in there. How would I go about doing that:
{
"time": 765,
"annotations": [
{
"start": 106,
"end": 115,
"spot": "customers",
"confidence": 0.7198,
"id": 234206,
"title": "Customer",
"uri": "h''ttp://en.wikipedia.org/wiki/Customer",
"label": "Customer"
},
{
"start": 116,
"end": 122,
"spot": "online",
"confidence": 0.6313,
"id": 41440,
''"title": "Online and offline",
"uri": "http://en.wikipedia.org/wiki/Online_and_offline",
"label": "Online"
},
{
"start": 138,
"end": 143,
"s''pot": "small",
"confidence": 0.7233,
"id": 276495,
"title": "Small business",
"uri": "http://en.wikipedia.org/wiki/Small_business",
"label''": "Small business"
}
]
}
I tried doing things like data["confidence"]
, but it didn't seem to pull the confidence figures. How do I pull the confidence figures in Python? Thank you in advance.
This is the code that retrieves the data:
import requests
api_key = INSERT API KEY
content_urls = "http://www.startupdonut.co.uk/sales-and-marketing/promote-your-business/using-social-media-to-promote-your-business"
url = "https://api.dandelion.eu/datatxt/nex/v1/?lang=en &url="+content_urls+"&token=" + api_key
request = requests.get(url)
for data in request:
print (data)