Title: feat(server): createUpstreamHttpClient + createTranslationMap (translator pattern helpers) · Issue #453 · adcontextprotocol/adcp-client-python · GitHub
Open Graph Title: feat(server): createUpstreamHttpClient + createTranslationMap (translator pattern helpers) · Issue #453 · adcontextprotocol/adcp-client-python
X Title: feat(server): createUpstreamHttpClient + createTranslationMap (translator pattern helpers) · Issue #453 · adcontextprotocol/adcp-client-python
Description: Parent: #452 JS source .changeset/adapter-translation-helpers.md (6.7). What Python adopters write today 200+ lines of httpx.AsyncClient boilerplate per upstream — auth header injection, 404→None translation, retry/timeout policy, JSON d...
Open Graph Description: Parent: #452 JS source .changeset/adapter-translation-helpers.md (6.7). What Python adopters write today 200+ lines of httpx.AsyncClient boilerplate per upstream — auth header injection, 404→None t...
X Description: Parent: #452 JS source .changeset/adapter-translation-helpers.md (6.7). What Python adopters write today 200+ lines of httpx.AsyncClient boilerplate per upstream — auth header injection, 404→None t...
Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/453
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(server): createUpstreamHttpClient + createTranslationMap (translator pattern helpers)","articleBody":"Parent: #452\n\n## JS source\n\n`.changeset/adapter-translation-helpers.md` (6.7).\n\n## What Python adopters write today\n\n200+ lines of `httpx.AsyncClient` boilerplate per upstream — auth header injection, 404→None translation, retry/timeout policy, JSON decode. See `examples/v3_reference_seller/src/upstream.py` for the canonical hand-rolled version.\n\nPlus per-adapter bidirectional code↔code translation maps (status enums, channel enums, etc.) hand-written as two parallel dicts that drift.\n\n## Proposed API\n\n```python\nfrom adcp.decisioning import create_upstream_http_client, create_translation_map\n\nclient = create_upstream_http_client(\n base_url=\"https://api.vendor.com\",\n auth={\"type\": \"static_bearer\", \"token\": \"...\"}, # or dynamic_bearer | api_key | none\n network_code=\"abc123\",\n default_headers={...},\n timeout_s=30.0,\n)\n# Typed get/post/put/delete returning parsed JSON or None on 404.\naccount = await client.get(\"/accounts/{id}\", params={...})\n\nstatus_map = create_translation_map[AdcpStatus, UpstreamStatus]({\n \"active\": \"ACTIVE\",\n \"paused\": \"PAUSED\",\n ...\n})\nstatus_map.to_upstream(\"active\") # \"ACTIVE\"\nstatus_map.to_adcp(\"ACTIVE\") # \"active\"\nstatus_map.has_adcp(\"active\") # True\nstatus_map.has_upstream(\"ACTIVE\") # True\n```\n\nAuth modes: `static_bearer` / `dynamic_bearer` (callable returning fresh token, used by OAuth passthrough in #6) / `api_key` / `none`.\n\n## Acceptance criteria\n\n- Both helpers exported from `adcp.decisioning`.\n- Tests cover: each auth mode, 404→None, retry on 5xx, JSON decode errors.\n- Translation map: round-trip identity, missing-key raises, generic typing.\n- `examples/v3_reference_seller/src/upstream.py` could be refactored to use them (defer that to a follow-up `v3-ref-seller-uses-helpers` PR).","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-05-03T11:28:08Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/453"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:41b9e235-47d0-2594-319a-948da1822ada |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 830C:1201C:C23EBB:103DCD7:6B00F68F |
| html-safe-nonce | 2a88e3b7ee3cae52befd2225d52477d930d7a2ff44aa357af70cbb54d20bfa7f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzBDOjEyMDFDOkMyM0VCQjoxMDNEQ0Q3OjZCMDBGNjhGIiwidmlzaXRvcl9pZCI6IjU2ODEwOTAxMjkxMTcxMTYwNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7926137c56fb21547f3805cbf9ced42b03e32b3d41eda495564071c7582b4f09 |
| hovercard-subject-tag | issue:4371629706 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/453/issue_layout |
| twitter:image | https://opengraph.githubassets.com/88792b48abb24db445937acfa7e2ad16dfce80c37a64c0aeb5b97e9dbed30546/adcontextprotocol/adcp-client-python/issues/453 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/88792b48abb24db445937acfa7e2ad16dfce80c37a64c0aeb5b97e9dbed30546/adcontextprotocol/adcp-client-python/issues/453 |
| og:image:alt | Parent: #452 JS source .changeset/adapter-translation-helpers.md (6.7). What Python adopters write today 200+ lines of httpx.AsyncClient boilerplate per upstream — auth header injection, 404→None t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bokelley |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git |
| octolytics-dimension-user_id | 221690821 |
| octolytics-dimension-user_login | adcontextprotocol |
| octolytics-dimension-repository_id | 1090305973 |
| octolytics-dimension-repository_nwo | adcontextprotocol/adcp-client-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1090305973 |
| octolytics-dimension-repository_network_root_nwo | adcontextprotocol/adcp-client-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width