Created
July 20, 2022 15:15
-
-
Save lebrunthibault/a2b9f6f5aea98872f28f7439d718ce4c to your computer and use it in GitHub Desktop.
kessel utility scripts
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
"""format emails for sending via {{prod}}/bo/actions/send_newsletter?post_id=id""" | |
import json | |
import sys | |
import pyperclip | |
from loguru import logger | |
with open("./emails.csv", "r") as f: | |
emails = [email[0:-1] for email in f.readlines()] | |
page = int(sys.argv[1]) | |
page_size = 40 | |
start, end = page * page_size, (page + 1) * page_size | |
total = len(emails) | |
email_page = emails[start:end] | |
output = json.dumps(email_page) | |
pyperclip.copy(output) | |
logger.warning(output) | |
logger.warning(f"{start} - {end - 1} / {total}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment