MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / _extract_code

Method _extract_code

src/services/web2_mail.py:159–176  ·  view source on GitHub ↗
(self, message: Dict[str, Any], pattern: str)

Source from the content-addressed store, hash-verified

157 return str(hash(str(message)))
158
159 def _extract_code(self, message: Dict[str, Any], pattern: str) -> Optional[str]:
160 subject = str(message.get("subject") or "").strip()
161 if subject:
162 match = re.search(pattern, subject)
163 if match:
164 return match.group(1)
165 fallback = subject.split(" ")[-1].strip()
166 if re.fullmatch(r"\d{4,8}", fallback):
167 return fallback
168
169 blob = "\n".join(
170 str(message.get(key) or "")
171 for key in ("subject", "text", "body", "html", "from")
172 )
173 match = re.search(pattern, blob)
174 if match:
175 return match.group(1)
176 return None
177
178 def create_email(self, config: Dict[str, Any] = None) -> Dict[str, Any]:
179 try:

Callers 1

get_verification_codeMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected