Skip to content

Instantly share code, notes, and snippets.

@conniec
Created July 5, 2012 23:02
Show Gist options
  • Save conniec/3056989 to your computer and use it in GitHub Desktop.
Save conniec/3056989 to your computer and use it in GitHub Desktop.
disable gravatar
from lfcore.ident.api import IdentAPI
import time, datetime
def disable_gravatar(domain_name):
throttle = 0.07
start_time = datetime.datetime.now()
d = Domain.objects.get(name=domain_name)
a = 0
b = 10000
while(True):
all_users = UserProfile.objects.filter(domain=d, state=RowState.enums().ENABLED)[a:b]
if len(all_users) == 0:
break
data = {
"gravatar_disabled": True
}
for (counter, user) in enumerate(all_users):
if counter % 20 == 0:
time.sleep(throttle)
if not user.gravatar_disabled:
IdentAPI.update_remote_profile(user, data)
print "User: %d - %s" % (user.id, user.gravatar_disabled)
a = b
b = b + 10000
end_time = datetime.datetime.now()
print 'Duration: %s' % str(end_time - start_time)
disable_gravatar('rooms.speedtv.fyre.co') #90220 users
disable_gravatar('rooms.foxsports.fyre.co') #50240 users
@mrobers1982
Copy link

For SpeedTV, we need to grab the users in chunks. Here is an example - https://gist.github.com/ac349456c68226263295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment