Your description appears to be a bit loose. Do you mean you want to calculate the bearing of the segments between bends, or the final heading of the end of the pipeline, or the included angle? Maybe you want to add a bend in the line given the offset implied by the joint name?
The math module has a function atan2() that returns a 360 degree bearing given the delta_x and delta_y.
There are also functions to convert radians to degrees and all the trig functions.