Skip to content

Commit

Permalink
More 3.8 compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed May 16, 2024
1 parent 73dc6c5 commit 08d82a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions ecoinvent_interface/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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__}
Expand All @@ -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__}
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ecoinvent_interface/process_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__}
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit 08d82a8

Please sign in to comment.