From 494d012909f6101e5959949070990221c7f5ff30 Mon Sep 17 00:00:00 2001 From: Albert Sedlacek Date: Thu, 5 Dec 2024 14:57:14 +0100 Subject: [PATCH] requirements freeze + revert changes on build_url method --- python-sync-actions/requirements.txt | 19 +++++++++---------- .../src/http_generic/client.py | 18 +++--------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/python-sync-actions/requirements.txt b/python-sync-actions/requirements.txt index a894a0c..752a7c4 100644 --- a/python-sync-actions/requirements.txt +++ b/python-sync-actions/requirements.txt @@ -1,10 +1,9 @@ -keboola.component -dataconf -keboola.http-client -keboola.utils -keboola.json-to-csv -mock -freezegun -nested-lookup -python-dateutil -camel-tools +keboola.component==1.6.8 +dataconf==3.3.0 +keboola.http-client==1.0.1 +keboola.utils==1.1.2 +keboola.json-to-csv==0.0.12 +mock==5.1.0 +freezegun==1.5.1 +nested-lookup==0.2.25 +python-dateutil==2.9.0.post0 diff --git a/python-sync-actions/src/http_generic/client.py b/python-sync-actions/src/http_generic/client.py index bcad24c..e8e0e80 100644 --- a/python-sync-actions/src/http_generic/client.py +++ b/python-sync-actions/src/http_generic/client.py @@ -4,7 +4,6 @@ from keboola.http_client import HttpClient from requests.adapters import HTTPAdapter from requests.exceptions import HTTPError, InvalidJSONError, ConnectionError -import urllib.parse as urlparse from urllib3 import Retry from http_generic.auth import AuthMethodBase @@ -63,20 +62,9 @@ def send_request(self, method, endpoint_path, **kwargs): message = f'Request "{method}: {endpoint_path}" failed with the following error: {e}' raise HttpClientError(message, resp) from e - def build_url(self, base_url, endpoint_path, is_absolute_path=False): - url_path = str(endpoint_path).strip() if endpoint_path is not None else '' - - if not url_path: - url = base_url - - elif not is_absolute_path: - full_path = urlparse.urljoin(base_url, url_path) - url = urlparse.quote(full_path, safe="/()=<>-&") - - else: - url = urlparse.quote(url_path, safe="/()=<>-&") - - return url + def build_url(self, base_url, endpoint_path): + self.base_url = base_url + return self._build_url(endpoint_path) # override to continue on retry error def _requests_retry_session(self, session=None):