mailjet / mailjet-apiv3-python

[API v3] Python Mailjet wrapper
https://dev.mailjet.com
MIT License
109 stars 40 forks source link

Transport endpoint is not connected #91

Open mehdiboutouzte opened 1 year ago

mehdiboutouzte commented 1 year ago

Hello,

I'm using mailjet wrapper with python 3.7 on google cloud function, but i'm getting some times this error message :

"/layers/google.python.pip/pip/lib/python3.7/site-packages/mailjet_rest/client.py", line 113, in api_call raise ApiError(e) mailjet_rest.client.ApiError: ('Connection aborted.', OSError(107, 'Transport endpoint is not connected'))

sahid commented 1 year ago

Yes I have the same issue mentioned. I don't think that the current code is compatible with up to python 3.6 at that point.

sahid commented 1 year ago

I have stopped to use the python client and replaced it by requests. That works perfectly well now.

@mehdiboutouzte, if you only send emails, It's easy:

requests.post("https://api.mailjet.com/v3.1/send", json=data, auth=(api_key, api_secret))
nchMrz commented 1 year ago

I have the same issue with python 3.7. The same code works utilizing a testing notebook in google vertex AI workbench, when I deploy and run utilizing a cloud function this error (the same error happens utilziing the request library)

Error; in send_emergency_mail_to_maintainers result = requests.post("https://api.mailjet.com/v3.1/send", json=data, auth=(API_KEY,API_SECRET)) File "/layers/google.python.pip/pip/lib/python3.7/site-packages/requests/api.py", line 115, in post return request("post", url, data=data, json=json, kwargs) File "/layers/google.python.pip/pip/lib/python3.7/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "/layers/google.python.pip/pip/lib/python3.7/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "/layers/google.python.pip/pip/lib/python3.7/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) File "/layers/google.python.pip/pip/lib/python3.7/site-packages/requests/adapters.py", line 501, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', OSError(107, 'Transport endpoint is not connected'))

fruecker commented 10 months ago

I deployed an flask app on heroku and encountered the same error. Restarting the dyno fixes it so it must be some kind of a timeout error.