Except for some female snakes just prior to egg laying and snakes undergoing planned hibernations, it is not normal for captive snakes to refuse to eat for more than one to two months. Without treatment, non-reversible liver and kidney damage can occur. Veterinary assistance is strongly recommended.
In addition to illness, anorexia can also be a sign that a snake does not feel secure enough in its cage to eat. This is a strong indication to improve husbandry and reduce stress.
For more information, please read the article Anorexia in Snakes.