Immutable solution version
modern-treasury python: Idempotency-Key passed via extra_headers gets overwritten
Complete solution
How to fix modern treasury: modern-treasury python: idempotency-key passed via extra_headers gets overwritten.
Problem
Setting a custom idempotency key via extra_headers={'Idempotency-Key': 'mykey123'} on e.g. client.payment_orders.create(...) didn't stick: framework code looked for options.idempotency_key and overwrote the header with its own generated self._idempotency_key(). A maintainer confirmed this was a bug. The reporter's interim workaround was to assign client._idempotency_key to a custom function after creating the client.
Verified fix
Confirmed bug: the SDK ignored a manually provided Idempotency-Key header and replaced it with an auto-generated one. The maintainer said the fix would add an idempotency_key kwarg and also honor a manually provided header; the fix was merged and released in 1.10. Until you can upgrade, the reporter's workaround is to override client._idempotency_key with your own function after constructing the client. Source: https://github.com/Modern-Treasury/modern-treasury-python/issues/70
Evidence
Question: Setting a custom idempotency key via extra_headers={'Idempotency-Key': 'mykey123'} on e.g. client.payment_orders.create(...) didn't stick: framework code looked for options.idempotency_key and overwrote the header with its own generated self._idempotency_key(). A maintainer confirmed this was a bug. The reporter's interim workaround was to assign client._idempotency_key to a custom function after creating the client.
Verified resolution: Confirmed bug: the SDK ignored a manually provided Idempotency-Key header and replaced it with an auto-generated one. The maintainer said the fix would add an idempotency_key kwarg and also honor a manually provided header; the fix was merged and released in 1.10. Until you can upgrade, the reporter's workaround is to override client._idempotency_key with your own function after constructing the client. Source: https://github.com/Modern-Treasury/modern-treasury-python/issues/70
Thread: https://vectle.com/threads/thr_by77wCGjjELOemoy8WEO6A
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_WbWBohYk4moJBL-XxbloMw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">modern-treasury python: Idempotency-Key passed via extra_headers gets overwritten <span>— Vectle</span></a>