Skip to content

Commit 09a0a1d

Browse files
committed
fix(exceptions): correct AdagentsAccessBlockedError suggestion text and add publisher_domain attr
- Replace wrong function name fetch_agent_authorizations_from_directory() with fetch_agent_authorizations() (correct public API) - Replace "buyers" terminology with "SDK callers" (domain-neutral) - Add self.publisher_domain attribute so err.publisher_domain is accessible - Tighten suggestion prose: remove AAO qualifier (function already implies it) Refs #801
1 parent 460b1de commit 09a0a1d

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/adcp/exceptions.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,31 +288,31 @@ def __init__(self, publisher_domain: str, timeout: float):
288288
class AdagentsAccessBlockedError(AdagentsValidationError):
289289
"""adagents.json fetch blocked by publisher-side bot management (403, cf-mitigated: challenge).
290290
291-
Only surfaces in direct-fetch workflows (``fetch_adagents``). Production
292-
buyers that use ``fetch_agent_authorizations_from_directory`` bypass
293-
publisher-side bot management entirely — the AAO directory crawler handles
294-
publisher fetches and serves cached results.
291+
Only surfaces in direct-fetch workflows (``fetch_adagents``). SDK callers that
292+
use ``fetch_agent_authorizations`` avoid this entirely — the AAO directory crawler
293+
handles publisher fetches and serves cached results without exposing the SDK to
294+
publisher-side bot management.
295295
296296
If you need to catch this specifically without catching all
297297
``AdagentsValidationError``s, use ``except AdagentsAccessBlockedError``.
298298
"""
299299

300300
def __init__(self, publisher_domain: str):
301301
"""Initialize bot-management blocked error."""
302+
self.publisher_domain = publisher_domain
302303
message = (
303304
f"adagents.json blocked by bot management for {publisher_domain} "
304305
f"(HTTP 403, cf-mitigated: challenge)"
305306
)
306307
suggestion = (
307308
"The publisher's origin blocked this request with a Cloudflare bot management\n"
308-
" challenge. This only affects direct adagents.json fetches; production\n"
309-
" buyers use the directory API which bypasses publisher-side bot management.\n"
309+
" challenge. This only affects direct adagents.json fetches (fetch_adagents).\n"
310310
"\n"
311311
" To unblock local debugging:\n"
312312
" - Retry with a browser-like User-Agent via the user_agent= parameter, e.g.\n"
313313
' user_agent="Mozilla/5.0"\n'
314-
" - Or use fetch_agent_authorizations_from_directory() to query via the\n"
315-
" AAO directory instead of fetching publisher adagents.json directly."
314+
" - Or call fetch_agent_authorizations() to query the AAO directory instead,\n"
315+
" which bypasses publisher-side bot management entirely."
316316
)
317317
super().__init__(message, None, None, suggestion)
318318

0 commit comments

Comments
 (0)