sendinblue / APIv3-python-library

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

AttributeError: module 'sib_api_v3_sdk' has no attribute 'ListsApi' #92

Open by225 opened 1 year ago

by225 commented 1 year ago

Received the above error when trying to get an instance of the ListsApi. Turns out that the lists_api module was not included in either of these files: sib_api_v3_sdk/init.py sib_api_v3_sdk/api/init.py

Adding an import line to each of these two files seemed to solve the problem: from sib_api_v3_sdk.api.lists_api import ListsApi

This fix did not seem to work in every environment, though. Ended up downgrading to v.7.5.0 on WSGI apps, and that seems to be working there. Fortunately, don't need the latest features yet.

mrmachine commented 1 month ago

Almost a year later this problem still exists. Very confusing when trying to follow the API docs linked to right from within my brevo.com account when the import fails. Sent me on a wild goose chase that also had me confused about brevo_python (which has the same problem) vs sib_api_v3_sdk.

Seems like a very simple to fix missing import? And a regression from 7.5.0 which does have the import? https://github.com/sendinblue/APIv3-python-library/blob/v7.5.0/sib_api_v3_sdk/__init__.py#L26

Does nobody use the Python SDK to add contacts to lists?

jmbremer commented 1 month ago

Confirmed today.

Just to clarify, as a workaround, in the module that I need Brevo lists, I do a direct import of

from sib_api_v3_sdk.api.lists_api import ListsApi

I am not touching Brevos API files.

On another note: Beware that the contact lookup API seems to accept email address spelling deviations like 'Xyz@abc.com` instead of a Brevo-stored 'xyz@abc.com'. (According to the email RFC the part before '@' is case sensitive, but most implementations don't observe this.) The list API however throws a contact-not-found exception, or worse a, contact-not-found-or-not-in-list-yet.