Skip to content

Commit b55d15b

Browse files
authored
Remove usage of file storing API key
1 parent a31bfa1 commit b55d15b

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/axiomatic/magic.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ class AXMagic:
1212
"""Class implementing magic functions for IPython.
1313
Import with `%load_ext axiomatic.magic`."""
1414

15-
def __init__(self):
15+
def __init__(self, api_key: str = os.getenv("AXIOMATIC_API_KEY")):
1616
self.folder = platformdirs.user_config_dir("axiomatic")
17-
if not os.path.exists(f"{self.folder}/api_key"):
18-
os.makedirs(self.folder, exist_ok=True)
19-
self.api_key = None
20-
else:
21-
with open(f"{self.folder}/api_key", "r") as f:
22-
self.api_key = f.read()
23-
self.ax = Axiomatic(api_key=self.api_key)
17+
18+
self.api_key = api_key
2419
self.query = ""
2520

2621
def ax_api(self, query):

0 commit comments

Comments
 (0)