Skip to content

Instantly share code, notes, and snippets.

@lebrunthibault
Created July 20, 2022 15:15
Show Gist options
  • Save lebrunthibault/a2b9f6f5aea98872f28f7439d718ce4c to your computer and use it in GitHub Desktop.
Save lebrunthibault/a2b9f6f5aea98872f28f7439d718ce4c to your computer and use it in GitHub Desktop.
kessel utility scripts
"""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