Q: If my lease agreement says no pets could my landlord evict me for having a dog even if I get a letter from a doc for esa
A: A lease that prohibits pets is valid, but ESA is an exception and if certified by a licensed physician the landlord has to allow the ESA. However, you can be evicted if the ESA becomes a nuisance or otherwise disrupts other tenant's quiet enjoyment of their premises.
To avoid the controversy, it is better to disclose to a potential landlord that you qualify and require a pet companion. Explain your general circumstances and describe your pet. Landlords will be much more receptive if they are not bushwacked and informed about an ESA after you sign the lease; however, you are not required to inform them before you sign the lease, but it will make your life easier.
Give respect to the landlord and landowner. They are the owner and infringements on their ownership rights are often taken as an attack on them. You want to be on their good side so that you can enjoy your tenancy and not be in constant battle.
If your condition that allows you an ESA after you have moved in you should consult the landlord about this. Since you have not already selected an animal you may want to get input from the landlord, although you are not obligated to take their opinion into consideration, but it would be beneficial to you to do so where possible.
A landlord that is intent on evicting you is going to make your life hell, so try to avoid that.