Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Fix nsrdb_weather key management (#1091)
Browse files Browse the repository at this point in the history
* Update nsrdb_weather.py

* Update nsrdb_weather.py

Co-authored-by: Alyona Teyber <[email protected]>
  • Loading branch information
David P. Chassin and aivanova5 authored Feb 2, 2022
1 parent 2932cb4 commit 2684a1f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions python_extras/nsrdb_weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def getemail():
"""Get the default email"""
global email
if not email:
keys = getkeys().keys()
keys = getkeys(new=True).keys()
if keys:
email = list(getkeys().keys())[0]
else:
Expand Down Expand Up @@ -235,7 +235,10 @@ def getkey(email=None):
if not email:
email = getemail()
if email:
return getkeys()[email]
try:
return getkeys()[email]
except:
return {}
else:
return None

Expand Down Expand Up @@ -569,7 +572,7 @@ def writeglm(data, glm=None, name=None, csv=None):
elif token == "--signup":
if not value:
error("you must provide an email address for the new credential",1)
credentials = getkeys()
credentials = getkeys(new=True)
if getemail() in credentials.keys():
error(f"you already have credentials for {value}",1)
else:
Expand Down Expand Up @@ -601,10 +604,7 @@ def writeglm(data, glm=None, name=None, csv=None):
shutil.rmtree(cachedir)
else:
error(f"option '{token}' is not valid",1)
if position and year:
data = getyears(year,float(position[0]),float(position[1]))
writeglm(data,glm,name,csv)


if position and year:
try:
data = getyears(year,float(position[0]),float(position[1]))
Expand Down

0 comments on commit 2684a1f

Please sign in to comment.