Persisting SessionsΒΆ
You can use a requests.Session object to persist the underlying TCP connection across multiple calls to the ScienceBase API. This can improve performance when making multiple calls to the pwfdf-api. To use an existing session for a pwfdf-api call, pass the Session object to the session input. For example:
from requests import Session
import pwfdf_api as pwfdf
# Create the session
session = Session()
# Make several calls using the same TCP connection
assessments(start_date=2025, session=session)
metadata(extent="California", session=session)
download(fire="Eaton", latest=True, session=session)