Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getGmailInfo():
- global gmail_user
- global gmail_pwd
- while True:
- hasgmail = raw_input('Do you have a Gmail account? (enter "yes" or "no"): ')
- if hasgmail.lower() == 'yes':
- break
- elif hasgmail.lower() == 'no':
- print 'Press enter to get one. This program will pause and a web browser will open'
- raw_input('')
- saveout = os.dup(2)
- os.close(2)
- os.open(os.devnull, os.O_RDWR)
- try:
- webbrowser.open_new_tab('https://www.google.com/accounts/NewAccount?service=mail')
- finally:
- break
- else:
- print 'Please enter either "yes" or "no" (without the quotation marks.'
- while True:
- gmail_user = raw_input('Please enter your Gmail username: ')
- if gmail_user.lower() == 'quit' or gmail_user.lower() == '"quit"':
- sys.exit(0) # this allows the user to quit if they need to make a gmail
- if len(gmail_user.split('@')) != 2: #checks for stuff after @
- print 'Error. Please enter a valid email address'
- elif gmail_user.split('@')[-1] != 'gmail.com': #checks for gmail email
- print 'Error. Please enter a gmail address.'
- else:
- print 'Email accepted.'
- break
- gmail_pwd = getpass.getpass('Please enter your Gmail password (it is not\
- displayed for security reasons, but I can assure you that you\'re still\
- entering it) Then press enter. ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement