  We compare theoretical results for electron spin resonance (ESR) properties
of the Heisenberg-Ising Hamiltonian with ESR experiments on the
quasi-one-dimensional magnet Cu(py)$_2$Br$_2$ (CPB). Our measurements were
performed over a wide frequency and temperature range giving insight into spin
dynamics, spin structure, and magnetic anisotropy of this compound. By
analyzing the angular dependence of ESR parameters (resonance shift and
linewidth) at room temperature we show that the two weakly coupled inequivalent
spin chain types inside the compound are well described by Heisenberg-Ising
chains with their magnetic anisotropy axes perpendicular to the chain direction
and almost perpendicular to each other. We further determine the full
$g$-tensor from these data. In addition, the angular dependence of the
linewidth at high temperatures gives us access to the exponent of the algebraic
decay of a dynamical correlation function of the isotropic Heisenberg chain.
From the temperature dependence of static susceptibilities we extract the
strength of the exchange coupling ($J/k_B = 52.0\,\text{K}$) and the anisotropy
parameter ($\delta\approx -0.02$) of the model Hamiltonian. An independent
compatible value of $\delta$ is obtained by comparing the exact prediction for
the resonance shift at low temperatures with high-frequency ESR data recorded
at $4\,\text{K}$. The spin structure in the ordered state implied by the two
(almost) perpendicular anisotropy axes is in accordance with the propagation
vector determined from neutron scattering experiments. In addition to undoped
samples we study the impact of partial substitution of Br by Cl ions on spin
dynamics. From the dependence of the ESR linewidth on doping level we infer an
effective decoupling of the anisotropic component $J\delta$ from the isotropic
exchange $J$ in these systems.
