Skip to content

Commit 04f2db7

Browse files
authored
Load MP API key in standard way
1 parent 46fdcdb commit 04f2db7

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

usage.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
from pymatgen import MPRester
1010
import os
1111

12-
try:
13-
os.environ["MP_API_KEY"]
14-
except KeyError:
15-
print("Please set the environment variable MP_API_KEY")
16-
sys.exit(1)
17-
1812
app = dash.Dash(__name__)
1913

2014
app.layout = html.Div(children=[
@@ -106,7 +100,7 @@ def display_output2(c):
106100
]
107101

108102
# This should be setted as an env variable instead
109-
with MPRester(os.environ["MP_API_KEY"]) as m:
103+
with MPRester() as m:
110104
q = m.query(criteria=query, properties=properties)
111105

112106
#print('RESULT', len(q))

0 commit comments

Comments
 (0)