E
E
ezbooz2021-04-03 20:09:45
Python
ezbooz, 2021-04-03 20:09:45

How to get value from json response?

I send a request, I get the following response:

"profiles": {
                    "4b46f672d17a417dabccc2ee3e53a38d": {
                        "profile_id": "4b46f672d17a417dabccc2ee3e53a38d",
                        "cute_name": "Strawberry"
                    }

How to get the values ​​​​of "profile_id" from here
I can only use a regular expression

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MinTnt, 2021-04-03
@ezbooz

r = requests.post(....)

print(r.json()['profiles'])

T
Tera Incognita, 2021-04-03
@Lunali

maybe make a cut?
search for profile_id in the text and slice
or make a variable that will get the value of profile_id
parsing=[ "News" , " https://bank.gov.ua/","Events","profile_id " ]
for z in parsing:
if(z[ 0:10]=="profile_id"):
print(z)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question