Skip to content

Commit

Permalink
Base endpoint added to core client
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Munro committed May 7, 2021
1 parent 9e4b716 commit a5b2a0c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mp_api/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def __init__(
"""

self.api_key = api_key
self.base_endpoint = endpoint
self.endpoint = endpoint
self.version = version
self.debug = debug
Expand Down Expand Up @@ -422,7 +423,11 @@ def get_document_by_id(
# this should likely be re-thought
from mp_api.matproj import MPRester

with MPRester() as mpr:
with MPRester(
api_key=self.api_key,
endpoint=self.base_endpoint,
version=self.version,
) as mpr:
new_document_id = mpr.get_materials_id_from_task_id(document_id)
warnings.warn(
f"Document primary key has changed from {document_id} to {new_document_id}, "
Expand Down

0 comments on commit a5b2a0c

Please sign in to comment.