A video of a giant 20-foot-long snake biting a California zookeeper in an attempt to protect her eggs has gone viral on social media.

The six-minute video, shared by zookeeper Jay Brewer on Instagram on Sunday, showed him trying to take away the snake's eggs to keep them in a safer place. However, the python got upset and attempted to strike the zookeeper several times before eventually biting him on his hand.

Brewer managed to take away the snake's eggs before carrying the reptile on his shoulder and walking to another room in the zoo.

"20Ft Snake Bit Me," he wrote in the caption. "Well this giant pied girl has never really liked me and in this video she finally gets me, not only is she super mom defending her eggs but she is only one generation from a wild snake making her genes a little more crazy. Regardless, she's a beautiful snake and her babies will be even prettier."

The clip ended with the zookeeper showing his bite marks to the camera and cleaning the wound with antiseptic. He also showed other animal bites on different parts of his body from three weeks ago.

The video has so far garnered more than a million views on social media and accumulated tons of comments from netizens. Many of them praised Brewer for his patience and dedication to his work.

"The patience and tranquility are beyond imaginable stay safe bud," one netizen wrote.

"We appreciate the work and education brotha!" another person noted.

Meanwhile, some netizens also talked about how intense the video was.

"My phone nearly fell down from my hand, I was also dodging it from here," a commenter said.

Brewer has more than 4.5 million followers on Instagram. His page is filled with photos and videos of reptiles like snakes and crocodiles.

Last month, he posted a jaw-dropping video of himself carrying a massive 22-foot-long yellow-tinted snake on his shoulder and walking around in the zoo.

"When no one is around to help move a 22 foot, 250lb snake. You do it the old fashion way yourself," he captioned the clip.

A Krabi Pitakpracha Foundation snake handler holds the four-metre (13 feet) king cobra he pulled from a sewer in southern Thailand
Representational image of a king cobra KRABI PITAKPRACHA FOUNDATION / Handout