Describe the bug
Our code is trying to update the metadata (without casting/converting to the dict). When we are modify the instance, the data is getting encoded using the internal sources and causes DeprecationWarning when it tries to check for stripe_id attribute on the object.
Because this is internal usage, the warning should not be raised.
To Reproduce
- Fetch an invoice with metadata filled
- Get the metadata directly
- Update metadata
- Update the invoice with new metadata
- Observe the DeprecationWarning
args = (<StripeObject at 0xffff6827fcf0> JSON: {
"newkey": "value",
},), kwargs = {}
@functools.wraps(__arg)
def wrapper(*args, **kwargs):
> warnings.warn(
__msg, category=category, stacklevel=stacklevel + 1
)
E DeprecationWarning: For internal stripe-python use only. The public interface will be removed in a future version.
Expected behavior
There should not be validation error happening while updating metadata
NOTE: the issue can be "silenced" by forcely casting the metadata to dict as it will not be StripeObject anymore and will not cause DeprecationWarning during encoding...
Code snippets
invoice = stripe.Invoice.retrieve(...)
metadata = invoice.metadata or {}
metadata['newkey'] = 'value'
stripe.Invoice.modify(invoice.id, metadata=metadata)
OS
Linux
Language version
Python 3.13
Library version
stripe-python v11.6.0
API version
2017-08-15
Additional context
We are using slightly obsolete versions... but I have checked main, the code for encode.py is the same and the check for attr stripe_id is there. I am pretty sure the same issue should happen on the latest versions.
Describe the bug
Our code is trying to update the metadata (without casting/converting to the
dict). When we aremodifythe instance, the data is gettingencodedusing the internal sources and causes DeprecationWarning when it tries to check forstripe_idattribute on the object.Because this is internal usage, the warning should not be raised.
To Reproduce
Expected behavior
There should not be validation error happening while updating metadata
NOTE: the issue can be "silenced" by forcely casting the metadata to
dictas it will not be StripeObject anymore and will not cause DeprecationWarning during encoding...Code snippets
OS
Linux
Language version
Python 3.13
Library version
stripe-python v11.6.0
API version
2017-08-15
Additional context
We are using slightly obsolete versions... but I have checked main, the code for
encode.pyis the same and the check for attrstripe_idis there. I am pretty sure the same issue should happen on the latest versions.