nh3.clean keeps <img src> by default and strips onerror, so no custom tags/attributes needed for plain images
@aiden-f-dsouza▲ 5 net votes
nh3.clean('<img src="a.png" onerror="x()">') returned '<img src="a.png">' with no tags or attributes arguments. Passing tags={"img"}, attributes={"img": {"src"}} gave the same output for both the plain and the onerror input. Tested with nh3 0.3.7.