Handle server error python
The easiest solution will be probably to try to validate the user input before you use it. A simple regular expression which checks the last parts of the domain the user has entered might be enough.
If you want to support arbitrary domains without a google\.[a-z]+ or appspot.com suffix you will need another way to figure out if the site matches your requirements or not. Unfortunately there is no "is-powered-by-google-or-has-a-google-like-login-page" header, so you will probably need to look at the content and use some heuristics if the page is likely to be a such a page or not.
The kind of server error (500 interrnal server error) you are now encountering might mean a lot. This error indicates that there is something wrong with your application or server configuration. For example, if you deploy a script with a syntax error, the web server will response with "server error" when someone tries to access it. Also, if you want to divide by 0 or try to access an non-existing element this kind of error will be shown. So, server-errors are just a very general name for programming errors which should be avoided (and fixed!).
I m workin on an api where the user enters a domain and i need to redirect to the login page of that domain.
So this works for only google domains and i need to handle the error created when user enters non google domain . I m workin on google app engine.
I m new to dis error handling.So kindly explain how it works along with the solution
The error i recieved is 
//Error: Server Error
The server encountered an error and could not complete your request.//
thaks in advance