Created
March 20, 2020 19:27
-
-
Save wadewilliams/4139c2b9c23ac36c601d7ff78f1db50f to your computer and use it in GitHub Desktop.
Check Users for Gravatar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import hashlib | |
from django.contrib.auth.models import User | |
ok = 0 | |
fail = 0 | |
for each in User.objects.all(): | |
hash = hashlib.md5(each.email.encode('utf-8')).hexdigest() | |
status = requests.get(f"https://www.gravatar.com/avatar/{hash}?d=404").status_code | |
if status == 200: | |
ok += 1 | |
else: | |
fail += 1 | |
print(status, each.email) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment