Python Hotmail login
I need a python script that prompts for a username and password and tries to login to Hotmail using those credentials,开发者_Go百科 outputting whether they are valid or not.
Hotmail login!
import poplib
M = poplib.POP3_SSL('pop3.live.com', 995) #Connect to hotmail pop3 server
try:
M.user(raw_input("username: ")) #Get the username from the standar input
M.pass_(raw_input("password: ")) #Get the password from the standar input
except:
print "username or password incorrect"
else:
print "Successful login"
Edit: since you only need to know if you can do a login, I rewrite the code
If you lose connection during the typing the username or password, I don't know what will happend.
This is alternative if pop3 failed. just check login using IMAP for hotmail,live or now only outlook.com by using python outlook library you can download here : https://github.com/awangga/outlook
import outlook
mail = outlook.Outlook()
mail.checkLogin()
it will attemp username and password for authentication validation.
精彩评论