Dear all:
I want to get a lot of data, but there are access restrictions, how to deal with this?
from mp_api.client import MPRester
import pandas as pd
with open(‘key.txt’) as f:
key = f.read()
with MPRester(api_key = key) as mpr:
docs = mpr.summary.search(exclude_elements=['Pb','La','Ce','Pr', 'Nd', 'Pm','Sm','Eu','Gd',
'Tb','Dy', 'Er', 'Tm', 'Yb', 'Lu', 'Y', 'Sc'],
fields=["material_id",
"formula",
"band_gap",
"volume"
])
test = pd.DataFrame(docs)
print(test)
test.to_csv('./b.csv', encoding='gbk')
mp_api.client.core.client.MPRestError: HTTPSConnectionPool(host=‘api.materialsproject.org’, port=443): Max retries exceeded with url: /materials/summary/?exclude_elements=Pb%2CLa%2CCe%2CPr%2CNd%2CPm%2CSm%2CEu%2CGd%2CTb%2CDy%2CEr%2CTm%2CYb%2CLu%2CY%2CSc&_limit=1000&_fields=material_id%2Cformula%2Cband_gap%2Cvolume&_skip=46000 (Caused by ProtocolError(‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’)))