Snakes can be sleeping when you go in their cage. You let them know you are coming in by tapping it first, as they hear via vibrations and not sound. If they are very still they may be sleeping and can get startled by your sudden presence in their cage, causing a defensive reaction.
Also, some snakes can become defensive of their enclosure and require a hook to be taken out and then they are fine in your hands. I would imagine you just startled her though.