From 08d82a82e319e7e67ea602116f8a938d79430ae2 Mon Sep 17 00:00:00 2001 From: Chris Mutel Date: Thu, 16 May 2024 09:21:08 -0400 Subject: [PATCH] More 3.8 compatibility fixes --- ecoinvent_interface/core.py | 10 +++++----- ecoinvent_interface/process_interface.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ecoinvent_interface/core.py b/ecoinvent_interface/core.py index 69958b0..9ee3331 100644 --- a/ecoinvent_interface/core.py +++ b/ecoinvent_interface/core.py @@ -127,7 +127,7 @@ def _get_credentials(self, post_data: dict) -> None: headers = { "ecoinvent-api-client-library": "ecoinvent_interface", "ecoinvent-api-client-library-version": __version__, - } | self.custom_headers + }.update(self.custom_headers) response = requests.post(sso_url, post_data, headers=headers, timeout=20) if response.ok: @@ -148,7 +148,7 @@ def _get_all_reports(self) -> dict: "Authorization": f"Bearer {self.access_token}", "ecoinvent-api-client-library": "ecoinvent_interface", "ecoinvent-api-client-library-version": __version__, - } | self.custom_headers + }.update(self.custom_headers) message = """Requesting URL. URL: {reports_url} Class: {self.__class__.__name__} @@ -166,7 +166,7 @@ def _get_all_files(self) -> dict: "Authorization": f"Bearer {self.access_token}", "ecoinvent-api-client-library": "ecoinvent_interface", "ecoinvent-api-client-library-version": __version__, - } | self.custom_headers + }.update(self.custom_headers) message = """Requesting URL. URL: {files_url} Class: {self.__class__.__name__} @@ -254,7 +254,7 @@ def _download_api_file( "Authorization": f"Bearer {self.access_token}", "ecoinvent-api-client-library": "ecoinvent_interface", "ecoinvent-api-client-library-version": __version__, - } | self.custom_headers + }.update(self.custom_headers) self._streaming_download( url=url, params=params, @@ -273,7 +273,7 @@ def _download_s3( "Authorization": f"Bearer {self.access_token}", "ecoinvent-api-client-library": "ecoinvent_interface", "ecoinvent-api-client-library-version": __version__, - } | self.custom_headers + }.update(self.custom_headers) s3_link = requests.get(url, headers=headers, timeout=20).json()["download_url"] self._streaming_download( url=s3_link, params={}, directory=directory, filename=filename diff --git a/ecoinvent_interface/process_interface.py b/ecoinvent_interface/process_interface.py index dabcf8a..6cac051 100644 --- a/ecoinvent_interface/process_interface.py +++ b/ecoinvent_interface/process_interface.py @@ -148,7 +148,7 @@ def _json_request(self, url: str) -> Union[dict, list]: "Authorization": f"Bearer {self.access_token}", "ecoinvent-api-client-library": "ecoinvent_interface", "ecoinvent-api-client-library-version": __version__, - } | self.custom_headers + }.update(self.custom_headers) message = """Requesting URL. URL: {url} Class: {self.__class__.__name__} @@ -189,7 +189,7 @@ def get_file(self, file_type: ProcessFileType, directory: Path) -> Path: "Authorization": f"Bearer {self.access_token}", "ecoinvent-api-client-library": "ecoinvent_interface", "ecoinvent-api-client-library-version": __version__, - } | self.custom_headers + }.update(self.custom_headers) if meta.get("type").lower() == "xml": headers["Accept"] = "text/plain"