Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e10daa4ed23a4fe87d6ea60836226446e042fdd3
9302385c295e8882b47b61945d61dc2470f0cfce
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2186
v2201
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
[![pypi](https://img.shields.io/pypi/v/stripe.svg)](https://pypi.python.org/pypi/stripe)
[![Build Status](https://github.com/stripe/stripe-python/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-python/actions?query=branch%3Amaster)

> [!TIP]
> Want to chat live with Stripe engineers? Join us on our [Discord server](https://stripe.com/go/discord/python).

The Stripe Python library provides convenient access to the Stripe API from
applications written in the Python language. It includes a pre-defined set of
classes for API resources that initialize themselves dynamically from API
Expand Down Expand Up @@ -195,7 +198,7 @@ print(customer.last_response.headers)
### How to use undocumented parameters and properties

In some cases, you might encounter parameters on an API request or fields on an API response that aren’t available in the SDKs.
This might happen when they’re undocumented or when they’re in preview and you aren’t using a preview SDK.
This might happen when they’re undocumented or when they’re in preview and you aren’t using a preview SDK.
See [undocumented params and properties](https://docs.stripe.com/sdks/server-side?lang=python#undocumented-params-and-fields) to send those parameters or access those fields.

### Writing a Plugin
Expand Down
13 changes: 7 additions & 6 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import (
Any,
AsyncIterable,
Callable,
Dict,
List,
Mapping,
Expand Down Expand Up @@ -545,14 +546,14 @@ def request_headers(
ua: Dict[str, Union[str, "AppInfo"]] = {
"bindings_version": VERSION,
"lang": "python",
"publisher": "stripe",
"httplib": self._get_http_client().name,
}
for attr, func in [
["lang_version", platform.python_version],
["platform", platform.platform],
["uname", lambda: " ".join(platform.uname())],
]:
attr_funcs: List[Tuple[str, Callable[[], str]]] = [
("lang_version", platform.python_version),
]
if stripe.enable_telemetry:
attr_funcs.append(("platform", platform.platform))
for attr, func in attr_funcs:
try:
val = func()
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def fetch_related_object(self) -> "Account":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -76,6 +77,7 @@ async def fetch_related_object_async(self) -> "Account":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -180,6 +182,9 @@ def fetch_related_object(self) -> "Account":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def fetch_related_object(self) -> "Account":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -65,6 +66,7 @@ async def fetch_related_object_async(self) -> "Account":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -109,6 +111,9 @@ def fetch_related_object(self) -> "Account":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def fetch_related_object(self) -> "Adjustment":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -61,6 +62,7 @@ async def fetch_related_object_async(self) -> "Adjustment":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -105,6 +107,9 @@ def fetch_related_object(self) -> "Adjustment":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def fetch_related_object(self) -> "FinancialAccount":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -63,6 +64,7 @@ async def fetch_related_object_async(self) -> "FinancialAccount":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -107,6 +109,9 @@ def fetch_related_object(self) -> "FinancialAccount":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def fetch_related_object(self) -> "FinancialAccount":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -63,6 +64,7 @@ async def fetch_related_object_async(self) -> "FinancialAccount":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -107,6 +109,9 @@ def fetch_related_object(self) -> "FinancialAccount":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def fetch_related_object(self) -> "FinancialAddress":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -63,6 +64,7 @@ async def fetch_related_object_async(self) -> "FinancialAddress":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -107,6 +109,9 @@ def fetch_related_object(self) -> "FinancialAddress":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def fetch_related_object(self) -> "FinancialAddress":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -63,6 +64,7 @@ async def fetch_related_object_async(self) -> "FinancialAddress":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -107,6 +109,9 @@ def fetch_related_object(self) -> "FinancialAddress":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -66,6 +67,7 @@ async def fetch_related_object_async(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -145,6 +147,9 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -65,6 +66,7 @@ async def fetch_related_object_async(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -109,6 +111,9 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -65,6 +66,7 @@ async def fetch_related_object_async(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -109,6 +111,9 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -65,6 +66,7 @@ async def fetch_related_object_async(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -109,6 +111,9 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand All @@ -65,6 +66,7 @@ async def fetch_related_object_async(self) -> "InboundTransfer":
"get",
self.related_object.url,
stripe_context=self.context,
headers={"Stripe-Request-Trigger": f"event={self.id}"},
usage=["fetch_related_object"],
)
return cast(
Expand Down Expand Up @@ -109,6 +111,9 @@ def fetch_related_object(self) -> "InboundTransfer":
"get",
self.related_object.url,
base_address="api",
options={"stripe_context": self.context},
options={
"stripe_context": self.context,
"headers": {"Stripe-Request-Trigger": f"event={self.id}"},
},
),
)
Loading
Loading