I usually hold my arms close to my body and stick my knee/leg out towards them, so if they try to jump on me (even if they're friendly) they get a body full of knee (don't legit, forcefully knee them though, just block them with it) and can't bite my arms if they're aggressive. It also sometimes works with excitable dogs because after trying to jump on me and just getting knee a few times they calm down more and wait for my attention.