Request configuration

RequestConfig controls request delay, retry count, timeout, and other requests keyword arguments. This notebook uses a live WebBook call with conservative settings.

[1]:
import nistchempy as nist

config = nist.RequestConfig(
    delay=0.5,
    max_attempts=2,
    kwargs={'timeout': 30.0},
)
config
[1]:
RequestConfig(delay=0.5, max_attempts=2, kwargs={'timeout': 30.0})
[2]:
compound = nist.get_compound('C7732185', request_config=config)  # water
compound.to_dict()
[2]:
{'record_type': 'compound',
 'compound_id': 'C7732185',
 'source_url': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185',
 'retrieved_at': '',
 'ID': 'C7732185',
 'name': 'Water',
 'synonyms': ['Water vapor',
  'Distilled water',
  'Ice',
  'H2O',
  'Dihydrogen oxide',
  'steam',
  'Tritiotope'],
 'formula': 'H 2 O',
 'mol_weight': 18.0153,
 'inchi': 'InChI=1S/H2O/h1H2',
 'inchi_key': 'XLYOFNOQVPJJNP-UHFFFAOYSA-N',
 'cas_rn': '7732-18-5',
 'mol_refs': {'mol2D': 'https://webbook.nist.gov/cgi/cbook.cgi?Str2File=C7732185',
  'mol3D': 'https://webbook.nist.gov/cgi/cbook.cgi?Str3File=C7732185'},
 'data_refs': {'cTG': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=1#Thermo-Gas',
  'cTC': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=2#Thermo-Condensed',
  'cTP': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=4#Thermo-Phase',
  'cTR': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=8#Thermo-React',
  'cIE': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=20#Ion-Energetics',
  'cIC': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=40#Ion-Cluster',
  'cIR': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=80#IR-Spec',
  'cMS': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=200#Mass-Spec',
  'cES': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=800#Electronic-Spec',
  'cGC': 'https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Mask=2000#Gas-Chrom',
  'Fluid Properties': 'https://webbook.nist.gov/cgi/fluid.cgi?ID=C7732185&Action=Page'},
 'nist_public_refs': {'Microwave spectra (on physics lab web site)': 'https://physics.nist.gov/cgi-bin/MolSpec/mole.pl?prefix=tri&molecule=H2O&type=fancy&clear=1',
  'Electron-Impact Ionization Cross Sections (on physics web site)': 'https://physics.nist.gov/cgi-bin/Ionization/table.pl?ionization=H2O',
  'Gas Phase Kinetics Database': 'https://kinetics.nist.gov/kinetics/rpSearch?cas=7732185',
  'Reference simulation:  SPC/E Water': 'http://www.cstl.nist.gov/srs/SPCE_WATER/index.htm',
  'X-ray Photoelectron Spectroscopy Database, version 5.0': 'https://srdata.nist.gov/xps/SpectralByCompdDd/1778'},
 'nist_subscription_refs': {'NIST / TRC Web Thermo Tables, "lite" edition (thermophysical and thermochemical data)': 'https://wtt-lite.nist.gov/wtt-lite/index.html?cmp=water',
  'NIST / TRC Web Thermo Tables, professional edition (thermophysical and thermochemical data)': 'https://wtt-pro.nist.gov/wtt-pro/index.html?cmp=water'}}
[3]:
# Optional: inspect the WebBook crawl-delay directive.
# nist.get_crawl_delay(config=config)