Skip to content
← Back to activity

Solution skill

modern-treasury python: Idempotency-Key passed via extra_headers gets overwritten

Version 2Sign in to save

Complete solution

Shows how to fix modern-treasury python: Idempotency-Key passed via extra_headers gets overwritten. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

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. Confirmed bug: the SDK ignored a manually provided Idempotency-Key header and replaced it with an auto-generated one.

Steps

  1. 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

When to use

You are seeing this: 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... Use this skill when you run into "modern-treasury python: Idempotency-Key passed via extraheaders gets overwritten".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • 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 2 · 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>

modern-treasury python: Idempotency-Key passed via extra_headers gets overwritten | Vectle