sendinblue / APIv3-python-library

SendinBlue's python library for API v3
MIT License
82 stars 40 forks source link

Issue using create_contact with update_enabled=True #18

Closed lescommis closed 5 years ago

lescommis commented 6 years ago

Hi,

create a new contact works fine :

  create_contact = sib_api_v3_sdk.CreateContact(email=email, list_ids=[2, ], attributes=merge_fields, update_enabled=True)`
  try:
      return api_instance.create_contact(create_contact)
  except ApiException as e:
      print("Exception when calling ContactsApi->create_contact: %s\n" % e)

but when I'm trying to update instead of create when the user already exists with the update_enabled=True option, I get this error :

  ..../local/lib/python2.7/site-packages/sib_api_v3_sdk/models/create_model.pyc in id(self, id)            
  if id is None:
  --->  raise ValueError("Invalid value for id, must not be None")  # noqa: E501   
  self._id = id

  ValueError: Invalid value for id, must not be None`

after investigation, it looks like that create_model.py (l. 61) is checking if the id of the response data is None :

  if id is None:
      raise ValueError("Invalid value for id, must not be None")  # noqa: E501   

but when updating an object, the response status is 204 and the data empty (according to documentation 204 - No content - The object was successfully updated or deleted) so it seems normal that is None.

Can you please, check this out ?

Thx

aakanksha-sib commented 5 years ago

Hi @lescommis , Thanks for addressing the issue. We have fixed the same. Thanks!