Use a rectangular contour with vertices $-i R$, $i R$, $-\pi + i R$, and $-\pi - i R$. The contour integral is then
$$i \int_{-R}^R \frac{dy}{\cosh{y}} + \int_0^{-\pi} \frac{dx}{\cos{(x+i R)}} - i \int_R^{-R} \frac{dy}{\cosh{y}} + \int_{-\pi}^0 \frac{dx}{\cos{(x-i R)}}$$
As $R \to \infty$, the second and fourth integrals vanish. Thus, by the residue theorem, your contour integral is
$$i 2 \int_{-\infty}^{\infty} \frac{dy}{\cosh{y}} = i 2 \pi $$
because the residue at the simple pole $z=-\pi/2$ is $1$.