diff --git a/l10n_fr_chorus_account/models/company.py b/l10n_fr_chorus_account/models/company.py
index 762f74638..c92e2bd0a 100644
--- a/l10n_fr_chorus_account/models/company.py
+++ b/l10n_fr_chorus_account/models/company.py
@@ -20,11 +20,12 @@
except ImportError:
logger.debug("Cannot import requests-oauthlib")
-API_URL = "https://api.aife.economie.gouv.fr"
-QUALIF_API_URL = "https://sandbox-api.aife.economie.gouv.fr"
-TOKEN_URL = "https://oauth.aife.economie.gouv.fr/api/oauth/token"
-QUALIF_TOKEN_URL = "https://sandbox-oauth.aife.economie.gouv.fr/api/oauth/token"
+API_URL = "https://api.piste.gouv.fr"
+QUALIF_API_URL = "https://sandbox-api.piste.gouv.fr"
+TOKEN_URL = "https://oauth.piste.gouv.fr/api/oauth/token"
+QUALIF_TOKEN_URL = "https://sandbox-oauth.piste.gouv.fr/api/oauth/token"
MARGIN_TOKEN_EXPIRY_SECONDS = 240
+TIMEOUT = 30
class ResCompany(models.Model):
@@ -159,6 +160,7 @@ def _get_new_token(self, oauth_id, oauth_secret, qualif):
"client_secret": oauth_secret,
"scope": "openid",
},
+ timeout=TIMEOUT,
)
logger.debug("_get_new_token HTTP answer code=%s", r.status_code)
except requests.exceptions.ConnectionError as e:
@@ -257,7 +259,11 @@ def chorus_post(self, api_params, url_path, payload, session=None):
logger.debug("Payload of the Chorus POST request: %s", payload)
try:
r = session.post(
- url, verify=True, data=json.dumps(payload), headers=headers
+ url,
+ verify=True,
+ data=json.dumps(payload),
+ headers=headers,
+ timeout=TIMEOUT,
)
except requests.exceptions.ConnectionError as e:
logger.error("Connection to %s failed. Error: %s", url, e)
diff --git a/l10n_fr_chorus_account/readme/CONFIGURE.rst b/l10n_fr_chorus_account/readme/CONFIGURE.rst
index 786dc9735..e9fa788f7 100644
--- a/l10n_fr_chorus_account/readme/CONFIGURE.rst
+++ b/l10n_fr_chorus_account/readme/CONFIGURE.rst
@@ -7,7 +7,7 @@ On the customers that you invoice via Chorus, you must:
If you want to use the Chorus API to easily send invoices to Chorus from Odoo, you must:
-* edit the Odoo server configuration file and add two keys *chorus_api_oauth_id* and *chorus_api_oauth_secret* that contain your Oauth client ID and client secret obtained via `PISTE `_. Don't forget to restart the Odoo server after the update of its configuration file.
+* edit the Odoo server configuration file and add two keys *chorus_api_oauth_id* and *chorus_api_oauth_secret* that contain your Oauth client ID and client secret obtained via `PISTE `_. Don't forget to restart the Odoo server after the update of its configuration file.
* in the menu *Accounting > Configuration > Settings*, in the section *Chorus API*, enable the option *Use Chorus API*, which will add all users to the *Chorus API* group. Then set the additional configuration parameters for Chorus API that will be prompted on the settings page.