Hooking splines with python in 2.8

Hello all,

How can I assing hook with python?
I manage to create a spline poly between center of cubes everything is fine but I can’t assing the points to Object through script just manually.
All the examples online are for bazier curves and not splines.
Help will be highly appreciated.