Browse Source

[FIX] *_online_ponto: Backport 9c1d6d0 to verify TLS connection

12.0
Ronald Portier (Therp BV) 2 years ago
parent
commit
4958e72cc4
No known key found for this signature in database GPG Key ID: A181F8124D7101D3
  1. 9
      account_bank_statement_import_online_ponto/models/online_bank_statement_provider_ponto.py

9
account_bank_statement_import_online_ponto/models/online_bank_statement_provider_ponto.py

@ -69,7 +69,6 @@ class OnlineBankStatementProviderPonto(models.Model):
url = PONTO_ENDPOINT + "/oauth2/token" url = PONTO_ENDPOINT + "/oauth2/token"
response = requests.post( response = requests.post(
url, url,
verify=False,
params={"grant_type": "client_credentials"}, params={"grant_type": "client_credentials"},
headers=self._ponto_header_token(), headers=self._ponto_header_token(),
) )
@ -94,7 +93,7 @@ class OnlineBankStatementProviderPonto(models.Model):
def _ponto_get_account_ids(self): def _ponto_get_account_ids(self):
url = PONTO_ENDPOINT + "/accounts" url = PONTO_ENDPOINT + "/accounts"
response = requests.get( response = requests.get(
url, verify=False, params={"limit": 100}, headers=self._ponto_header()
url, params={"limit": 100}, headers=self._ponto_header()
) )
if response.status_code == 200: if response.status_code == 200:
data = json.loads(response.text) data = json.loads(response.text)
@ -120,7 +119,7 @@ class OnlineBankStatementProviderPonto(models.Model):
} }
} }
response = requests.post( response = requests.post(
url, verify=False, headers=self._ponto_header(), json=data
url, headers=self._ponto_header(), json=data
) )
if response.status_code in (200, 201, 400): if response.status_code in (200, 201, 400):
data = json.loads(response.text) data = json.loads(response.text)
@ -138,7 +137,7 @@ class OnlineBankStatementProviderPonto(models.Model):
number = 0 number = 0
while number == 100: while number == 100:
number += 1 number += 1
response = requests.get(url, verify=False, headers=self._ponto_header())
response = requests.get(url, headers=self._ponto_header())
if response.status_code == 200: if response.status_code == 200:
data = json.loads(response.text) data = json.loads(response.text)
status = data.get("status", {}) status = data.get("status", {})
@ -158,7 +157,7 @@ class OnlineBankStatementProviderPonto(models.Model):
latest_identifier = False latest_identifier = False
while page_url: while page_url:
response = requests.get( response = requests.get(
page_url, verify=False, params=params, headers=self._ponto_header()
page_url, params=params, headers=self._ponto_header()
) )
if response.status_code == 200: if response.status_code == 200:
if params.get("before"): if params.get("before"):

Loading…
Cancel
Save