diff --git a/README.md b/README.md index 0c87a3f..04fd779 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,15 @@ Before you begin, ensure you have met the following requirements: - `GEN_NUMBER` = 200 # Input the number of cards you want to gen - `EMPLOYEE_EMAIL` = "" # Input the email of the user you want to gen cards with - `CARD_PREFIX` = "CARD_" # Input a string that will be in the card name (card names will be `{CARD_PREFIX}_1,{CARD_PREFIX}_2,...` +- `START_WITH_INDEX` = 0 # INDEX WITH YOU WANT TO START CREATING YOUR CARD / COPYING YOUR CARDS EX. (44) {CARD_PREFIX}_44, {CARD_PREFIX}_45... - `SMS_VERIFICATION` #Use True if you want to confirm sms code and store card information in "cards.csv" +## Notes +If you're trying to copy from a specific index, put the index number where it stopped - 1. Like if it stopped writing details on csv on card 5, to start copying again from 5 you should input 4. ## Troubleshooting -- This action is forbidden returned means you have to refresh the token cookie - +- This action is forbidden returned means you have to refresh the token cookie ## Device Id Request diff --git a/config.py b/config.py index 4bf3103..65af557 100644 --- a/config.py +++ b/config.py @@ -7,7 +7,7 @@ GEN_NUMBER = 200 #HOW MANY CARDS TO GEN EMPLOYEE_EMAIL = "" #WHICH TEAM MEMBER TO USE CARD_PREFIX = "CARD_" #USED TO LABEL GENERATED CARDS -START_WITH_INDEX = 0 #INDEX WITH YOU WANT TO START CREATING YOUR CARD EX. (44) {CARD_PREFIX}_44, {CARD_PREFIX}_45... +START_WITH_INDEX = 0 #INDEX WITH YOU WANT TO START CREATING YOUR CARD / COPYING YOUR CARDS EX. (44) {CARD_PREFIX}_44, {CARD_PREFIX}_45... SMS_VERIFICATION = True #USE True if you want to confirm sms code and store card information in "cards.csv" diff --git a/gen.py b/gen.py index 64f1df8..89b33c3 100644 --- a/gen.py +++ b/gen.py @@ -72,14 +72,21 @@ def __init__(self) -> None: if config.COPY_ONLY: self.get_all_cards() - for key,value in self.cards.items(): - self.card_id = key - self.card_name = value["name"] - self.card_exp_month = value["expiryDate"].split("/")[0] - self.card_exp_year = value["expiryDate"].split("/")[1] - self.log_info(f"Retrieved Card {self.card_name}") - if config.SMS_VERIFICATION: - self.get_card_details() + if config.START_WITH_INDEX != 0: + self.log_info(f"Copying from index: {config.START_WITH_INDEX}") + self.cards = list(self.cards.items()) + for i in range(config.START_WITH_INDEX, len(self.cards)): + self.card_id = self.cards[i][0] + self.card_name = self.cards[i][1]["name"] + self.card_exp_month = self.cards[i][1]["expiryDate"].split("/")[0] + self.card_exp_year = self.cards[i][1]["expiryDate"].split("/")[1] + self.log_info(f"Retrieved Card {self.card_name}") + if config.SMS_VERIFICATION: + self.get_card_details() + else: + self.log_info("Copying all cards details") + self.copy_all_cards() + else: for n in range(0, int(config.GEN_NUMBER)): self.log_info(f"Generating Card {n+config.START_WITH_INDEX}") @@ -352,6 +359,15 @@ def get_card_details(self): return + def copy_all_cards(self): + for key,value in self.cards.items(): + self.card_id = key + self.card_name = value["name"] + self.card_exp_month = value["expiryDate"].split("/")[0] + self.card_exp_year = value["expiryDate"].split("/")[1] + self.log_info(f"Retrieved Card {self.card_name}") + if config.SMS_VERIFICATION: + self.get_card_details() def write_card_details(self): with open(self.csv_location, 'a') as fd: