Skip to content

Instantly share code, notes, and snippets.

@wadewilliams
Created March 20, 2020 19:27
Show Gist options
  • Save wadewilliams/4139c2b9c23ac36c601d7ff78f1db50f to your computer and use it in GitHub Desktop.
Save wadewilliams/4139c2b9c23ac36c601d7ff78f1db50f to your computer and use it in GitHub Desktop.
Check Users for Gravatar
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