diff --git a/odev/_version.py b/odev/_version.py index 5626e70..73bc621 100644 --- a/odev/_version.py +++ b/odev/_version.py @@ -22,4 +22,4 @@ # or merged change. # ------------------------------------------------------------------------------ -__version__ = "4.27.0" +__version__ = "4.27.1" diff --git a/odev/common/connectors/rest.py b/odev/common/connectors/rest.py index db22fb0..28e8ce8 100644 --- a/odev/common/connectors/rest.py +++ b/odev/common/connectors/rest.py @@ -307,7 +307,7 @@ def _request( @abstractmethod def request( self, - method: Literal["GET"] | Literal["POST"], + method: Literal["GET", "POST", "HEAD"], path: str, authenticate: bool = True, params: dict | None = None, @@ -348,6 +348,18 @@ def post(self, path: str, params: dict | None = None, authenticate: bool = True, """ return self.request("POST", path, params=params, authenticate=authenticate, **kwargs) + def head(self, path: str, params: dict | None = None, authenticate: bool = True, **kwargs) -> Response: + """Perform a HEAD request to the endpoint. + Authentication is handled automatically using the Odoo credentials stored in the secrets vault. + + :param path: The path to the resource. + :param params: The parameters to pass to the request. + :param kwargs: Additional keyword arguments to pass to the request. + :return: The response from the endpoint. + :rtype: requests.Response + """ + return self.request("HEAD", path, params=params, authenticate=authenticate, **kwargs) + def download(self, path: str, file_path: Path, progress_message: str = "Downloading", **kwargs) -> Path: """Download a file from the endpoint. diff --git a/odev/common/databases/local.py b/odev/common/databases/local.py index b574839..6e83a50 100644 --- a/odev/common/databases/local.py +++ b/odev/common/databases/local.py @@ -125,7 +125,7 @@ def venv(self) -> PythonEnv: if self._venv is None: info = self.store.databases.get(self) - if info is None: + if info is None or not info.virtualenv: if self.version is None: return PythonEnv()