We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MP_API_KEY
MP_API_KEY is retrieved at import time, perhaps considering getting at init time instead janosh/pymatviz#207 (comment)?
init
api/mp_api/client/mprester.py
Line 72 in 2c89d4c
If someone want to set the environment variable at runtime (assume no MP_API_KEY env var is set beforehand), it would fail:
import os from mp_api.client import MPRester # >>> os.environ.get("MP_API_KEY", None) being execuated os.environ["MP_API_KEY"] = "KEY" mp_api = os.environ.get("MP_API_KEY") assert mp_api is not None # >>> passes struct = MPRester().get_structure_by_material_id("mp-19017") # >>> fails as MP_API_KEY is None
The text was updated successfully, but these errors were encountered:
That's true. The only way to set the API key at runtime right now is explicitly setting the argument in MPRester(), i.e.
MPRester()
struct = MPRester(mp_api).get_structure_by_material_id("mp-19017")
We happily accept PRs that maintain backward compatibility though 😄
Sorry, something went wrong.
MPRester
endpoint
api_key
Successfully merging a pull request may close this issue.
MP_API_KEY
is retrieved at import time, perhaps considering getting atinit
time instead janosh/pymatviz#207 (comment)?api/mp_api/client/mprester.py
Line 72 in 2c89d4c
If someone want to set the environment variable at runtime (assume no
MP_API_KEY
env var is set beforehand), it would fail:The text was updated successfully, but these errors were encountered: