Identify if a Specific Edge Pixel Belongs to Horizontal, Vertical or Diagonal Edge Line
Not sure how you do it in python, but the idea can be as simple as the following:

After you select a random point on the edge pixel, calculate the horizontal gradient and the vertical gradient with this pixel at the centre of the gradient filter.

The width of the  kernel for the gradient filters will depend on the maximum width of the edges. For example if the edges are 3 pixel wide have a 5x5 gradient filter.

If the magnitude of vertical gradient is more than horizontal gradient then the pixel belongs to horizontal edge and vice versa for vertical edge.

Also for diagonal edge similarly you can have a kernel which calculated diagonal gradients, if diagonal gradients are not exactly 45 degrees, you might need to to increase the size of the kernel to get more angular resolution of gradients.

Hope that helps.