i have this request but its with a strange behaviour and im having dificulties get the values a need.
heres an example:
response = requests.get('https://api-prd.dev/analytics/api/properties?filter[a.id]=' + aid, headers=headers)
request = response.json()
print(":0:->>>> ", request['data'][0])
the prints are like this:
:0:->>>> {'type': 'id-snapshot-property', 'id': 'adblue_level_percentage', 'attributes': {'updateDate': '2022-10-07T13:39:32Z', 'value': '0'}}
How do i get the value 0 in adblue_level_percentage
response: request['data'][0]['attributes']['value']
import json
response = requests.get('https://api-prd.dev/analytics/api/properties?filter[a.id]=' + aid, headers=headers)
request = json.loads(response)
now you have dict object and fetch value by calling dict key
>>> import requests
>>> r = requests.get('https://api.github.com/events')
>>> r.json()
[{'repository': {'open_issues': 0, 'url': 'https://github.com/...'}}]
response = requests.get('https://api-prd.dev/analytics/api/properties?filter[a.id]=' + aid, headers=headers)
data = response.json()
This should also work. It also delivers a dictionary which you can access via its keys.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.