Saving multiple poses to Pose Library via Python
I find a solution. If somebody else would want to do that, here's the code:

bpy.ops.pose.select_all(action="TOGGLE")
bpy.ops.poselib.pose_add(frame=1+num_poses,name=str(num_poses))
bpy.ops.pose.select_all(action="DESELECT")


Before adding new poses, Blender requires that you select and deselect pose. Otherwise not whole armature is saved.