Initial commit — Performance West telecom compliance platform
Includes: API (Express/TypeScript), Astro site, Python workers, document generators, FCC compliance tools, Canada CRTC formation, Ansible infrastructure, and deployment scripts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
f8cd37ac8c
1823 changed files with 145167 additions and 0 deletions
47
scripts/workers/fix_349.py
Normal file
47
scripts/workers/fix_349.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import requests, re, html, time
|
||||
|
||||
URL = "http://localhost:9100"
|
||||
s = requests.Session()
|
||||
s.auth = ("api", "6X1rKPea61N4rZ1S65Hx5zvqzbCj30F6nvEe9oVGH_Y")
|
||||
|
||||
r = s.get(URL + "/api/campaigns", params={"per_page": 100}, timeout=15)
|
||||
campaigns = r.json()["data"]["results"]
|
||||
|
||||
for c in sorted(campaigns, key=lambda x: x["id"]):
|
||||
if c["id"] == 1:
|
||||
continue
|
||||
rb = s.get(URL + "/api/campaigns/" + str(c["id"]), timeout=15)
|
||||
full = rb.json()["data"]
|
||||
body = full["body"]
|
||||
|
||||
new_body = body \
|
||||
.replace("$349 CAD", "$349 USD") \
|
||||
.replace("C$349", "$349 USD") \
|
||||
.replace("$349/yr", "$349 USD/yr") \
|
||||
.replace("$349/year", "$349 USD/year") \
|
||||
.replace("349 CAD/yr", "349 USD/yr") \
|
||||
.replace("349 CAD/year", "349 USD/year") \
|
||||
.replace("\u2014 C$349", "\u2014 $349 USD") \
|
||||
.replace("C$349/yr", "$349 USD/yr")
|
||||
|
||||
if new_body == body:
|
||||
continue
|
||||
|
||||
if full["status"] == "finished":
|
||||
print("SKIP finished [" + str(c["id"]) + "] " + c["name"][:50])
|
||||
continue
|
||||
|
||||
resp = s.put(URL + "/api/campaigns/" + str(c["id"]), 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": new_body,
|
||||
"tags": full.get("tags", []),
|
||||
"headers": full.get("headers", []),
|
||||
}, timeout=15)
|
||||
print("Fixed [" + str(c["id"]) + "] HTTP " + str(resp.status_code) + " " + c["name"][:50])
|
||||
time.sleep(0.15)
|
||||
|
||||
print("Done.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue