| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._stripe_service import StripeService |
| 4 |
from importlib import import_module |
| 5 |
from typing_extensions import TYPE_CHECKING |
| 6 |
|
| 7 |
if TYPE_CHECKING: |
| 8 |
from stripe.v2.core._account_link_service import AccountLinkService |
| 9 |
from stripe.v2.core._account_service import AccountService |
| 10 |
from stripe.v2.core._account_token_service import AccountTokenService |
| 11 |
from stripe.v2.core._event_destination_service import ( |
| 12 |
EventDestinationService, |
| 13 |
) |
| 14 |
from stripe.v2.core._event_service import EventService |
| 15 |
|
| 16 |
_subservices = { |
| 17 |
"accounts": ["stripe.v2.core._account_service", "AccountService"], |
| 18 |
"account_links": [ |
| 19 |
"stripe.v2.core._account_link_service", |
| 20 |
"AccountLinkService", |
| 21 |
], |
| 22 |
"account_tokens": [ |
| 23 |
"stripe.v2.core._account_token_service", |
| 24 |
"AccountTokenService", |
| 25 |
], |
| 26 |
"events": ["stripe.v2.core._event_service", "EventService"], |
| 27 |
"event_destinations": [ |
| 28 |
"stripe.v2.core._event_destination_service", |
| 29 |
"EventDestinationService", |
| 30 |
], |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
class CoreService(StripeService): |
| 35 |
accounts: "AccountService" |
| 36 |
account_links: "AccountLinkService" |
| 37 |
account_tokens: "AccountTokenService" |
| 38 |
events: "EventService" |
| 39 |
event_destinations: "EventDestinationService" |
| 40 |
|
| 41 |
def __init__(self, requestor): |
| 42 |
super().__init__(requestor) |
| 43 |
|
| 44 |
def __getattr__(self, name): |
| 45 |
try: |
| 46 |
import_from, service = _subservices[name] |
| 47 |
service_class = getattr( |
| 48 |
import_module(import_from), |
| 49 |
service, |
| 50 |
) |
| 51 |
setattr( |
| 52 |
self, |
| 53 |
name, |
| 54 |
service_class(self._requestor), |
| 55 |
) |
| 56 |
return getattr(self, name) |
| 57 |
except KeyError: |
| 58 |
raise AttributeError() |