Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
32 changes: 24 additions & 8 deletions gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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:
Expand Down