  We examine the class of weakly porous sets in Euclidean spaces. As our first
main result we show that the distance weight
$w(x)=\operatorname{dist}(x,E)^{-\alpha}$ belongs to the Muckenhoupt class
$A_1$, for some $\alpha>0$, if and only if $E\subset\mathbb{R}^n$ is weakly
porous. We also give a precise quantitative version of this characterization in
terms of the so-called Muckenhoupt exponent of $E$. When $E$ is weakly porous,
we obtain a similar quantitative characterization of $w\in A_p$, for
$1<p<\infty$, as well. At the end of the paper, we give an example of a set
$E\subset\mathbb{R}$ which is not weakly porous but for which $w\in
A_p\setminus A_1$ for every $0<\alpha<1$ and $1<p<\infty$.
