Skip to content

Commit

Permalink
formatting; 32 apikey length
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Dec 13, 2022
1 parent 02e322f commit bebe77b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mp_api/client/mprester.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ class MPRester:

def __init__(
self,
api_key=DEFAULT_API_KEY,
endpoint=DEFAULT_ENDPOINT,
notify_db_version=False,
include_user_agent=True,
api_key: str = DEFAULT_API_KEY,
endpoint: str = DEFAULT_ENDPOINT,
notify_db_version: bool = False,
include_user_agent: bool = True,
monty_decode: bool = True,
use_document_model: bool = True,
session: Session = None,
Expand Down Expand Up @@ -121,9 +121,9 @@ def __init__(
headers (dict): Custom headers for localhost connections.
"""

if api_key and len(api_key) == 16:
if api_key and len(api_key) != 32:
raise ValueError(
"Please use a new API key from https://next-gen.materialsproject.org/api "
"Please use a new API key from https://materialsproject.org/api "
"Keys for the new API are 32 characters, whereas keys for the legacy "
"API are 16 characters."
)
Expand Down

0 comments on commit bebe77b

Please sign in to comment.