Your snake is demonstrating classic “fight or flight” behavior. This is what animals (and humans for that matter!) do when they believe their life is in immediate danger.
It’s hard wired in those little snakes that anything that picked them up is going to eat them.
He’s basically frightened as hell.
It’s important to gently handle them and allow them to sit in your hands and crawl through them rather than “grasping” them.
Act like you are the branch and let them explore you…and soon the snake will come to understand that you are not a threat and calm down. But when it’s held in a grasping manner…it’s going to panic.
Fight or flight…your snake must not be a biter, because if he was, that’s when you would have gotten bitten.