You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Estoy usando
data = {"contact": {"email": email}}
response = client.contacts.create_or_update_contact(data)
if response['contact']['id']:
en algunas ocasiones me entrega este error en el if ->TypeError: string indices must be integers
¿Cual es el formato del response? para poder controlar si viene correctamente o ocurrió un error?
muchas gracias
Saludos
The text was updated successfully, but these errors were encountered:
alecamilla
changed the title
Cual es el formata response
Cual es el formato response
Apr 22, 2021
Lo resolví de la siguiente manera, aca va un ejemplo:
email = '[email protected]'
idsList = 12
data = {"contact": {"email": email}}
response = client.contacts.create_or_update_contact(data)
try:
dato = response.get('contact', '')
if dato!='':
idContact = response['contact']['id']
data = { "contactList": { "list": idsList, "contact": idContact, "status": 1 } }
response = client.contacts.update_list_status_for_a_contact(data)
try:
dato = response.get('contactList', '')
if dato=='':
msn='Error API:'
if response['errors'][0]['title']:
msn = msn + response['errors'][0]['title']
else:
msn = msn +'a ocurrido problemas a conectarse.'
except AttributeError:
pass
msn = response
elif dato=='':
if response['errors'][0]['title']:
msn = 'Error API:' + response['errors'][0]['title']
Hola a todos:
Estoy usando
data = {"contact": {"email": email}}
response = client.contacts.create_or_update_contact(data)
if response['contact']['id']:
en algunas ocasiones me entrega este error en el if ->TypeError: string indices must be integers
¿Cual es el formato del response? para poder controlar si viene correctamente o ocurrió un error?
muchas gracias
Saludos
The text was updated successfully, but these errors were encountered: