Skip to content

Commit

Permalink
Merge pull request #7 from ecmwf/develop
Browse files Browse the repository at this point in the history
Release 0.7.4
  • Loading branch information
jameshawkes authored Mar 14, 2024
2 parents a93a5ea + 13b1a38 commit 5877a7c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions polytope/api/Auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def get_auth_headers(self):
user_key, user_email, _ = self.fetch_key(login=False)
if user_key and user_email:
auth_headers.append("EmailKey %s:%s" % (user_email, user_key))
if user_key and not user_email:
auth_headers.append("Bearer %s" % (user_key))
config = self.config.get()
bearer_key = config["user_key"]
if bearer_key:
Expand Down Expand Up @@ -152,16 +154,16 @@ def fetch_key(self, login=True):
try:
with open(str(key_file), "r") as infile:
info = json.load(infile)
key = info["user_key"]
email = info["user_email"]
key = info.get("user_key", None)
email = info.get("user_email", None)

# TODO: this is messy
except FileNotFoundError:
try:
with open(str(Path.home() / ".ecmwfapirc"), "r") as infile:
info = json.load(infile)
key = info["key"]
email = info["email"]
key = info.get("user_key", None)
email = info.get("user_email", None)
except FileNotFoundError:
key = None
email = None
Expand Down
2 changes: 1 addition & 1 deletion polytope/api/RequestManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def _download(self, response, output_file, append, request_id=None):
output_file = request_id + ".covjson"
else:
random_id = "".join(random.choices(string.ascii_letters + string.digits, k=16))
output_file = "tmp" + random_id + ".grib"
output_file = "tmp" + random_id + ".covjson"
return self._download_to_file(response, output_file, append)
elif content_type == "application/octet-stream":
if output_file:
Expand Down
2 changes: 1 addition & 1 deletion polytope/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.3"
__version__ = "0.7.4"

0 comments on commit 5877a7c

Please sign in to comment.