BaseHook is Airflow’s abstract base class for custom hooks that connect tasks to external systems. A custom hook subclasses it, stores a connection ID, and usually implements get_conn. section 9.2.1
Build a configurable API hook
For a movie-rating API, MovielensHook accepts a connection ID, retrieves configuration through BaseHook.get_connection, constructs a requests session and base URL, and returns them as a Connection object. Credentials come from Airflow’s connection store rather than hardcoded constants. Session and URL values can be cached for reuse.
