Created
July 13, 2018 12:40
-
-
Save maxmanders/a6327eb4dafc334fb32a792c57655350 to your computer and use it in GitHub Desktop.
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
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