import requests, re, time
URL = "http://localhost:9100"
s = requests.Session()
s.auth = ("api", "6X1rKPea61N4rZ1S65Hx5zvqzbCj30F6nvEe9oVGH_Y")
# ── Fix remaining evasion phrases in campaigns 5 and 8 ──────────────────────
for cid in [5, 8]:
rb = s.get(URL + "/api/campaigns/" + str(cid), timeout=15)
full = rb.json()["data"]
body = full["body"]
body = body \
.replace("Outside FCC jurisdiction.", "A second carrier identity, under Canadian telecom law.") \
.replace("The FCC has no authority over a Canadian corporation.",
"Canadian carriers are regulated by the CRTC under Canadian telecom law.") \
.replace("Canadian CRTC entity \u2014 separate jurisdiction, clean slate",
"Canadian CRTC entity \u2014 a second carrier identity") \
.replace("Canadian CRTC entity \u2014 same +1, a separate regulatory framework",
"Canadian CRTC entity \u2014 same +1 country code, CRTC-registered")
s.put(URL + "/api/campaigns/" + str(cid), json={
"name": full["name"], "subject": full["subject"],
"lists": [li["id"] for li in full.get("lists", [])],
"type": full["type"], "content_type": full["content_type"], "body": body,
}, timeout=15)
print(f"Fixed [{cid}]")
time.sleep(0.2)
# ── Rewrite process walkthrough emails (ISP 6/7 = id 11, CRTC 6/7 = id 17) ──
WE_HANDLE = (
'
'
'Here is everything we handle.
\n'
'\n'
'- BC corporation incorporated \u2014 separate legal entity from your US company
\n'
'- CRTC BITS registration filed and confirmed
\n'
'- Canadian DID provisioned and configured
\n'
'- Vancouver virtual registered office established
\n'
'- .ca domain registered under your BC corporation number
\n'
'- Email hosting provisioned \u2014 up to 14 addresses at your .ca domain
\n'
'- Full corporate binder compiled and delivered digitally
\n'
'- Canadian business banking referral sent
\n'
'
'
)
YOU_DO = (
''
'Here is everything you do.
\n'
'\n'
'- Review and eSign the BC incorporation articles (5 minutes)
\n'
'- Choose your .ca domain via our client portal (5 minutes)
\n'
'- Open your Canadian business bank account (remote, under 5 minutes)
\n'
'
'
)
for cid in [11, 17]:
rb = s.get(URL + "/api/campaigns/" + str(cid), timeout=15)
full = rb.json()["data"]
body = full["body"]
original = body
# Replace week-by-week "what we handle" section
body = re.sub(
r']*>(?:The \d+\u201310 week process|What we handle)[^<]*
.*?',
WE_HANDLE,
body, flags=re.DOTALL
)
# Replace "what you do" section
body = re.sub(
r']*>(?:Your time investment[^<]*|What you do)[^<]*
.*?',
YOU_DO,
body, flags=re.DOTALL
)
# Fix header subheadline
body = body.replace(
"6\u201310 weeks.
About 30 minutes of your time.",
"We handle everything.
About 30 minutes of your time."
)
# Fix subject
new_subject = full["subject"].replace(
"What 6\u201310 weeks of Canadian carrier setup actually looks like",
"What we do, and what you do"
).replace(
"What 6 weeks of Canadian carrier setup actually looks like",
"What we do, and what you do"
)
s.put(URL + "/api/campaigns/" + str(cid), json={
"name": full["name"], "subject": new_subject,
"lists": [li["id"] for li in full.get("lists", [])],
"type": full["type"], "content_type": full["content_type"], "body": body,
}, timeout=15)
changed = "changed" if body != original else "no regex match — check manually"
print(f"Rewritten [{cid}] {full['name'][:55]} — {changed}")
print(f" subject: {new_subject}")
time.sleep(0.2)
print("\nDone.")