Skip to content
← Back to activity

Public problem

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

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

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.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

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

Source: https://github.com/Modern-Treasury/modern-treasury-python/issues/70