MCPcopy Create free account
hub / github.com/AlphaGPU/leetgpu-challenges / update_challenge

Function update_challenge

scripts/update_challenges.py:128–140  ·  view source on GitHub ↗
(service_url: str, payload: Dict, api_key: str)

Source from the content-addressed store, hash-verified

126
127def update_challenge(service_url: str, payload: Dict, api_key: str) -> bool:
128 url = f"{service_url.rstrip('/')}/api/v1/challenges"
129 headers = {"Authorization": f"Bearer {api_key}"} if api_key else {}
130
131 try:
132 with requests.Session() as session:
133 r = session.post(url, json=payload, headers=headers, timeout=30, allow_redirects=True)
134 r.raise_for_status()
135 logger.info("Updated challenge %s: %s", payload["id"], payload["title"])
136 return True
137 except Exception as e:
138 logger.error("Failed challenge %s: %s", payload["id"], e)
139 return False
140
141
142def main():
143 parser = argparse.ArgumentParser()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected