diff --git a/mail_tracking_mailgun/README.rst b/mail_tracking_mailgun/README.rst index 1a6c5f5b1..594d5c09d 100644 --- a/mail_tracking_mailgun/README.rst +++ b/mail_tracking_mailgun/README.rst @@ -7,7 +7,7 @@ Mail tracking for Mailgun !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:8f1f90f9d396cee0a417a6ad7820cf9eb0d9115c51ef82aaf19c13d84b2f2e4d + !! source digest: sha256:8920907240b8a1e7fceee196aa3c437a5c4ea4864588b43458c13b55d708ea36 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Mail tracking for Mailgun :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github - :target: https://github.com/OCA/social/tree/15.0/mail_tracking_mailgun + :target: https://github.com/OCA/social/tree/16.0/mail_tracking_mailgun :alt: OCA/social .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_tracking_mailgun + :target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_tracking_mailgun :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -67,6 +67,10 @@ You can also config partner email autocheck with this system parameter: - `mailgun.auto_check_partner_email`: Set it to True. +You can also config timeout for mailgun with this system parameter: + +- `mailgun.timeout`: Set it to a number of seconds. + Usage ===== @@ -102,7 +106,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -149,6 +153,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/social `_ project on GitHub. +This module is part of the `OCA/social `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_tracking_mailgun/__manifest__.py b/mail_tracking_mailgun/__manifest__.py index 348863be2..644d930eb 100644 --- a/mail_tracking_mailgun/__manifest__.py +++ b/mail_tracking_mailgun/__manifest__.py @@ -6,7 +6,7 @@ { "name": "Mail tracking for Mailgun", "summary": "Mail tracking and Mailgun webhooks integration", - "version": "15.0.1.1.1", + "version": "16.0.1.0.0", "category": "Social Network", "website": "https://github.com/OCA/social", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/mail_tracking_mailgun/controllers/main.py b/mail_tracking_mailgun/controllers/main.py index d8a33106d..8795f830d 100644 --- a/mail_tracking_mailgun/controllers/main.py +++ b/mail_tracking_mailgun/controllers/main.py @@ -64,12 +64,12 @@ class MailTrackingController(main.MailTrackingController): # See https://documentation.mailgun.com/en/latest/user_manual.html#routes try: self._mail_tracking_mailgun_webhook_verify( - **request.jsonrequest["signature"] + **request.dispatcher.jsonrequest["signature"] ) except ValidationError as error: raise NotAcceptable from error # Process event request.env["mail.tracking.email"].sudo()._mailgun_event_process( - request.jsonrequest["event-data"], + request.dispatcher.jsonrequest["event-data"], self._request_metadata(), ) diff --git a/mail_tracking_mailgun/models/mail_tracking_email.py b/mail_tracking_mailgun/models/mail_tracking_email.py index f16ff9513..a1dad645f 100644 --- a/mail_tracking_mailgun/models/mail_tracking_email.py +++ b/mail_tracking_mailgun/models/mail_tracking_email.py @@ -217,6 +217,9 @@ class MailTrackingEmail(models.Model): url, auth=("api", api_key), params=params, + timeout=self.env["ir.config_parameter"] + .sudo() + .get_param("mailgun.timeout", 10), ) if not res or res.status_code != 200: raise UserError(_("Couldn't retrieve Mailgun information")) diff --git a/mail_tracking_mailgun/models/res_partner.py b/mail_tracking_mailgun/models/res_partner.py index b072af8da..02101fc95 100644 --- a/mail_tracking_mailgun/models/res_partner.py +++ b/mail_tracking_mailgun/models/res_partner.py @@ -61,6 +61,9 @@ class ResPartner(models.Model): urljoin(params.api_url, "/v3/address/validate"), auth=("api", params.validation_key), params={"address": partner.email, "mailbox_verification": True}, + timeout=self.env["ir.config_parameter"] + .sudo() + .get_param("mailgun.timeout", 10), ) if ( not res @@ -136,6 +139,9 @@ class ResPartner(models.Model): res = requests.get( urljoin(api_url, "/v3/%s/bounces/%s" % (domain, partner.email)), auth=("api", api_key), + timeout=self.env["ir.config_parameter"] + .sudo() + .get_param("mailgun.timeout", 10), ) if res.status_code == 200 and not partner.email_bounced: partner.email_bounced = True @@ -156,6 +162,9 @@ class ResPartner(models.Model): urljoin(api_url, "/v3/%s/bounces" % domain), auth=("api", api_key), data={"address": partner.email}, + timeout=self.env["ir.config_parameter"] + .sudo() + .get_param("mailgun.timeout", 10), ) partner.email_bounced = res.status_code == 200 and not partner.email_bounced @@ -172,6 +181,9 @@ class ResPartner(models.Model): res = requests.delete( urljoin(api_url, "/v3/%s/bounces/%s" % (domain, partner.email)), auth=("api", api_key), + timeout=self.env["ir.config_parameter"] + .sudo() + .get_param("mailgun.timeout", 10), ) if res.status_code in (200, 404) and partner.email_bounced: partner.email_bounced = False diff --git a/mail_tracking_mailgun/readme/CONFIGURE.rst b/mail_tracking_mailgun/readme/CONFIGURE.rst index cb85e3032..30366268e 100644 --- a/mail_tracking_mailgun/readme/CONFIGURE.rst +++ b/mail_tracking_mailgun/readme/CONFIGURE.rst @@ -10,3 +10,7 @@ To configure this module, you need to: You can also config partner email autocheck with this system parameter: - `mailgun.auto_check_partner_email`: Set it to True. + +You can also config timeout for mailgun with this system parameter: + +- `mailgun.timeout`: Set it to a number of seconds. diff --git a/mail_tracking_mailgun/static/description/index.html b/mail_tracking_mailgun/static/description/index.html index 1186c699a..8eab58cf4 100644 --- a/mail_tracking_mailgun/static/description/index.html +++ b/mail_tracking_mailgun/static/description/index.html @@ -367,9 +367,9 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:8f1f90f9d396cee0a417a6ad7820cf9eb0d9115c51ef82aaf19c13d84b2f2e4d +!! source digest: sha256:8920907240b8a1e7fceee196aa3c437a5c4ea4864588b43458c13b55d708ea36 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

This module integrates mail_tracking events with Mailgun webhooks.

Mailgun (https://www.mailgun.com/) is a service that provides an e-mail sending infrastructure through an SMTP server or via API. You can also @@ -419,6 +419,10 @@ you need to add mail_tracking_mailgun addon to

  • mailgun.auto_check_partner_email: Set it to True.
+

You can also config timeout for mailgun with this system parameter:

+
    +
  • mailgun.timeout: Set it to a number of seconds.
  • +

Usage

@@ -451,7 +455,7 @@ Mailgun in Odoo. However, it doesn’t come without its GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -494,7 +498,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/social project on GitHub.

+

This module is part of the OCA/social project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/mail_tracking_mailgun/wizards/res_config_settings.py b/mail_tracking_mailgun/wizards/res_config_settings.py index b4e92d8f4..a434d559b 100644 --- a/mail_tracking_mailgun/wizards/res_config_settings.py +++ b/mail_tracking_mailgun/wizards/res_config_settings.py @@ -82,6 +82,9 @@ class ResConfigSettings(models.TransientModel): webhooks = requests.get( urljoin(params.api_url, "/v3/domains/%s/webhooks" % params.domain), auth=("api", params.api_key), + timeout=self.env["ir.config_parameter"] + .sudo() + .get_param("mailgun.timeout", 10), ) webhooks.raise_for_status() for event, data in webhooks.json()["webhooks"].items(): @@ -100,6 +103,9 @@ class ResConfigSettings(models.TransientModel): "/v3/domains/%s/webhooks/%s" % (params.domain, event), ), auth=("api", params.api_key), + timeout=self.env["ir.config_parameter"] + .sudo() + .get_param("mailgun.timeout", 10), ) response.raise_for_status() @@ -116,6 +122,9 @@ class ResConfigSettings(models.TransientModel): urljoin(params.api_url, "/v3/domains/%s/webhooks" % params.domain), auth=("api", params.api_key), data={"id": event, "url": [odoo_webhook]}, + timeout=self.env["ir.config_parameter"] + .sudo() + .get_param("mailgun.timeout", 10), ) # Assert correct registration response.raise_for_status()