Answer the question
In order to leave comments, you need to log in
How to display certain values through the AMOCRM API?
Hello. I want to display in a separate df several lines by a certain value.
The request itself: https://############.amocrm.ru/api/v2/leads?query=...
The problem is that the values I need may not always be in the same place . For example:
'ID курса' : testdata['_embedded']['items'][i]['custom_fields'][3]['values'][0]['value']
# будет находится не здесь, а например в
'ID курса' : testdata['_embedded']['items'][i]['custom_fields'][4]['values'][0]['value']
rows_list = []
for i in range(len(testdata['_embedded']['items'])):
dict1 = {}
# Так как в custom_fields нужно не менее 5 полей
if len(testdata['_embedded']['items'][i]['custom_fields']) > 4:
dict1.update({'ID курса' : testdata['_embedded']['items'][i]['custom_fields'][3]['values'][0]['value'],
'Этап сделки' : testdata['_embedded']['items'][i]['status_id'],
'ClientID' : testdata['_embedded']['items'][i]['custom_fields'][4]['values'][0]['value']})
rows_list.append(dict1)
df1 = pd.DataFrame(rows_list)
print(df1)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question