Skip to content

Instantly share code, notes, and snippets.

@maxmanders
Created July 13, 2018 12:40
Show Gist options
  • Save maxmanders/a6327eb4dafc334fb32a792c57655350 to your computer and use it in GitHub Desktop.
Save maxmanders/a6327eb4dafc334fb32a792c57655350 to your computer and use it in GitHub Desktop.
def remove(emails, infile):
try
if emails and infile:
raise ValueError('Specify one or more emails, or a file path, but not both')
pass
except ValueError as e:
print(e)
sys.exit(1)
if emails:
for e in emails:
try
remove_user_by_email(e)
except UserNotFoundException as e:
pass
except RemoveUserException as e:
pass
if infile:
try:
with open(infile, 'rb') as csvfile:
rowreader = csv.reader(csvfile, delimiter='')i
for row in rowreader:
email = row[0]
try:
remove_user_by_email(email)
except UserNotFoundException as e:
pass
except RemoveUserException as e:
pass
except csv.Error:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment