Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Thu Nov 21 16:58:20 2019
  4.  
  5. @author: VladimirZamyatin
  6. """
  7.  
  8. from validate_email import validate_email
  9.  
  10. def domainDict(email_file):
  11. temp = {}
  12. with open(email_file, 'r') as f:
  13. for line in f:
  14. line = line.strip().split('@')
  15. temp[line[-1]] = True
  16. return(temp)
  17.  
  18. def readEmails(email_file):
  19. temp = {}
  20. with open(email_file, 'r') as f:
  21. for line in f:
  22. line = line.strip()
  23. temp[line] = False
  24. return(temp)
  25. #print(len(domainSet('BGRS2020_emails.txt')))
  26.  
  27. emails = readEmails('BGRS2020_emails.txt')
  28. emails = ['asiodhaiodoipnsdio@gmail.com', 'zamyatin97@gmail.com']
  29. verified_domains = set()
  30. for email in emails:
  31. domain = email.split("@")[-1]
  32. domain_verified = domain in verified_domains
  33. is_valid = validate_email(email_address = email, check_mx = not domain_verified)
  34. if is_valid:
  35. emails[email] = True
  36. verified_domains.add(domain)
  37. with open('valid_BGRS2020_emails.txt', 'w') as f:
  38. f.write(email + '\n')
  39. print(1)
  40. else: print(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement