mapping using cylindrical map via script
I am not a professional myself, but the code looks okay, I guess. Your direction isn't "view", though, but "VIEW_ON_EQUATOR", you could also use "VIEW_ON_POLES", "ALIGN_TO_OBJECT", though: see the documentation

If it's "right" or "wrong" depends a little on the shape of your objects and how you want the unwrap to be aligned to it. Maybe try out all three and see which one fits best?