Skip to content

Commit d517014

Browse files
authored
Merge pull request #31 from brightway-lca/account-error
Notify users of account action required
2 parents e71ac4d + 7d0d9f9 commit d517014

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ecoinvent_interface/core.py

+13
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,19 @@ def _get_credentials(self, post_data: dict) -> None:
136136
self.last_refresh = time()
137137
self.access_token = tokens["access_token"]
138138
self.refresh_token = tokens["refresh_token"]
139+
elif any("error" in key.lower() for key in response.json()):
140+
error_messages = [
141+
msg for key, msg in response.json().items() if "error" in key.lower()
142+
]
143+
if "Account is not fully set up" in error_messages:
144+
warnings.warn(
145+
"Action required: please login to ecoquery to update your account."
146+
)
147+
else:
148+
warnings.warn(
149+
f"Error(s) found. Can't login correctly. Error log:\n{error_messages}"
150+
)
151+
response.raise_for_status()
139152
else:
140153
warnings.warn(
141154
"Given credentials can't log in: error {}".format(response.status_code)

0 commit comments

Comments
 (0)