INNER CODE UNIT · Python
_scrape_token
cipi-sh/cipi · lib/cipi-crowdsec-rescue.py:87
def _scrape_token(out: str) -> str:
for line in (out or "").splitlines():
if line.startswith("RESCUE_OK "):
return line[len("RESCUE_OK ") :].strip()
return ""
def _redeem(ip: str) -> str:
env = os.environ.copy()
env["CIPI_RESCUE_REDEEM"] = "1"
try:
proc = subprocess.run(
[CIPI, "crowdsec", "redeem", ip],
check=False,
capture_output=True,
text=True,
env=env,
timeout=REDEEM_TIMEOUT,