Skip to content

Commit

Permalink
feat: add a command to get all shad users info
Browse files Browse the repository at this point in the history
  • Loading branch information
AmooHashem committed Jan 13, 2025
1 parent 2c6beec commit 7c67fc6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions apps/accounts/management/commands/get_shad_users_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from django.core.management import BaseCommand

from apps.accounts.models import User
from proxies.Shad import get_user_data_from_shad, update_user_info_by_shad_data


class Command(BaseCommand):

def handle(self, *args, **options):
for user in User.objects.filter(origin='SHAD', is_temporary=True):
try:
user_data = get_user_data_from_shad(
user_uuid=user.username,
landing_id=284,
)
update_user_info_by_shad_data(user, user_data)
user.is_temporary = False
user.save()
except:
pass

self.stdout.write(self.style.SUCCESS('update all shad users'))

0 comments on commit 7c67fc6

Please sign in to comment.