...
General information related to downloading the data via web-api, is described here:
https://confluence.ecmwf.int/display/WEBAPI/Web-API+Downloads
Specifically, follow the steps here to install the latest code version:
https://pypi.org/project/ecmwf-api-client/
Briefly, install this with the pip command:
pip install ecmwf-api-client
You will now have the modules needed in the python scripts. (I actually needed this command for the ECMWF system pip install --user ecmwf-api-client because of local permssions).
Login and retrieve your "key":
Login at:
https://apps.ecmwf.int/auth/login/
Retrieve your key at:
Create and paste the "key" information in here:
$HOME/.ecmwfapirc
You will also need to accept the terms before you can access the data with web-api otherwise you will get an error when you run the script.