From bebe77bd8700c4069c31d1d51f2b7d008d7b29d1 Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Tue, 13 Dec 2022 14:08:22 -0800 Subject: [PATCH] formatting; 32 apikey length --- mp_api/client/mprester.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mp_api/client/mprester.py b/mp_api/client/mprester.py index 24d75552..9c0f4fc1 100644 --- a/mp_api/client/mprester.py +++ b/mp_api/client/mprester.py @@ -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, @@ -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." )