| 1 |
|
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
import typing |
| 6 |
|
| 7 |
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 8 |
from .raw_client import AsyncRawAttackProtectionClient, RawAttackProtectionClient |
| 9 |
|
| 10 |
if typing.TYPE_CHECKING: |
| 11 |
from .bot_detection.client import AsyncBotDetectionClient, BotDetectionClient |
| 12 |
from .breached_password_detection.client import ( |
| 13 |
AsyncBreachedPasswordDetectionClient, |
| 14 |
BreachedPasswordDetectionClient, |
| 15 |
) |
| 16 |
from .brute_force_protection.client import AsyncBruteForceProtectionClient, BruteForceProtectionClient |
| 17 |
from .captcha.client import AsyncCaptchaClient, CaptchaClient |
| 18 |
from .phone_provider_protection.client import AsyncPhoneProviderProtectionClient, PhoneProviderProtectionClient |
| 19 |
from .suspicious_ip_throttling.client import AsyncSuspiciousIpThrottlingClient, SuspiciousIpThrottlingClient |
| 20 |
|
| 21 |
|
| 22 |
class AttackProtectionClient: |
| 23 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 24 |
self._raw_client = RawAttackProtectionClient(client_wrapper=client_wrapper) |
| 25 |
self._client_wrapper = client_wrapper |
| 26 |
self._bot_detection: typing.Optional[BotDetectionClient] = None |
| 27 |
self._breached_password_detection: typing.Optional[BreachedPasswordDetectionClient] = None |
| 28 |
self._brute_force_protection: typing.Optional[BruteForceProtectionClient] = None |
| 29 |
self._captcha: typing.Optional[CaptchaClient] = None |
| 30 |
self._phone_provider_protection: typing.Optional[PhoneProviderProtectionClient] = None |
| 31 |
self._suspicious_ip_throttling: typing.Optional[SuspiciousIpThrottlingClient] = None |
| 32 |
|
| 33 |
@property |
| 34 |
def with_raw_response(self) -> RawAttackProtectionClient: |
| 35 |
""" |
| 36 |
Retrieves a raw implementation of this client that returns raw responses. |
| 37 |
|
| 38 |
Returns |
| 39 |
------- |
| 40 |
RawAttackProtectionClient |
| 41 |
""" |
| 42 |
return self._raw_client |
| 43 |
|
| 44 |
@property |
| 45 |
def bot_detection(self): |
| 46 |
if self._bot_detection is None: |
| 47 |
from .bot_detection.client import BotDetectionClient |
| 48 |
|
| 49 |
self._bot_detection = BotDetectionClient(client_wrapper=self._client_wrapper) |
| 50 |
return self._bot_detection |
| 51 |
|
| 52 |
@property |
| 53 |
def breached_password_detection(self): |
| 54 |
if self._breached_password_detection is None: |
| 55 |
from .breached_password_detection.client import BreachedPasswordDetectionClient |
| 56 |
|
| 57 |
self._breached_password_detection = BreachedPasswordDetectionClient(client_wrapper=self._client_wrapper) |
| 58 |
return self._breached_password_detection |
| 59 |
|
| 60 |
@property |
| 61 |
def brute_force_protection(self): |
| 62 |
if self._brute_force_protection is None: |
| 63 |
from .brute_force_protection.client import BruteForceProtectionClient |
| 64 |
|
| 65 |
self._brute_force_protection = BruteForceProtectionClient(client_wrapper=self._client_wrapper) |
| 66 |
return self._brute_force_protection |
| 67 |
|
| 68 |
@property |
| 69 |
def captcha(self): |
| 70 |
if self._captcha is None: |
| 71 |
from .captcha.client import CaptchaClient |
| 72 |
|
| 73 |
self._captcha = CaptchaClient(client_wrapper=self._client_wrapper) |
| 74 |
return self._captcha |
| 75 |
|
| 76 |
@property |
| 77 |
def phone_provider_protection(self): |
| 78 |
if self._phone_provider_protection is None: |
| 79 |
from .phone_provider_protection.client import PhoneProviderProtectionClient |
| 80 |
|
| 81 |
self._phone_provider_protection = PhoneProviderProtectionClient(client_wrapper=self._client_wrapper) |
| 82 |
return self._phone_provider_protection |
| 83 |
|
| 84 |
@property |
| 85 |
def suspicious_ip_throttling(self): |
| 86 |
if self._suspicious_ip_throttling is None: |
| 87 |
from .suspicious_ip_throttling.client import SuspiciousIpThrottlingClient |
| 88 |
|
| 89 |
self._suspicious_ip_throttling = SuspiciousIpThrottlingClient(client_wrapper=self._client_wrapper) |
| 90 |
return self._suspicious_ip_throttling |
| 91 |
|
| 92 |
|
| 93 |
class AsyncAttackProtectionClient: |
| 94 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 95 |
self._raw_client = AsyncRawAttackProtectionClient(client_wrapper=client_wrapper) |
| 96 |
self._client_wrapper = client_wrapper |
| 97 |
self._bot_detection: typing.Optional[AsyncBotDetectionClient] = None |
| 98 |
self._breached_password_detection: typing.Optional[AsyncBreachedPasswordDetectionClient] = None |
| 99 |
self._brute_force_protection: typing.Optional[AsyncBruteForceProtectionClient] = None |
| 100 |
self._captcha: typing.Optional[AsyncCaptchaClient] = None |
| 101 |
self._phone_provider_protection: typing.Optional[AsyncPhoneProviderProtectionClient] = None |
| 102 |
self._suspicious_ip_throttling: typing.Optional[AsyncSuspiciousIpThrottlingClient] = None |
| 103 |
|
| 104 |
@property |
| 105 |
def with_raw_response(self) -> AsyncRawAttackProtectionClient: |
| 106 |
""" |
| 107 |
Retrieves a raw implementation of this client that returns raw responses. |
| 108 |
|
| 109 |
Returns |
| 110 |
------- |
| 111 |
AsyncRawAttackProtectionClient |
| 112 |
""" |
| 113 |
return self._raw_client |
| 114 |
|
| 115 |
@property |
| 116 |
def bot_detection(self): |
| 117 |
if self._bot_detection is None: |
| 118 |
from .bot_detection.client import AsyncBotDetectionClient |
| 119 |
|
| 120 |
self._bot_detection = AsyncBotDetectionClient(client_wrapper=self._client_wrapper) |
| 121 |
return self._bot_detection |
| 122 |
|
| 123 |
@property |
| 124 |
def breached_password_detection(self): |
| 125 |
if self._breached_password_detection is None: |
| 126 |
from .breached_password_detection.client import AsyncBreachedPasswordDetectionClient |
| 127 |
|
| 128 |
self._breached_password_detection = AsyncBreachedPasswordDetectionClient( |
| 129 |
client_wrapper=self._client_wrapper |
| 130 |
) |
| 131 |
return self._breached_password_detection |
| 132 |
|
| 133 |
@property |
| 134 |
def brute_force_protection(self): |
| 135 |
if self._brute_force_protection is None: |
| 136 |
from .brute_force_protection.client import AsyncBruteForceProtectionClient |
| 137 |
|
| 138 |
self._brute_force_protection = AsyncBruteForceProtectionClient(client_wrapper=self._client_wrapper) |
| 139 |
return self._brute_force_protection |
| 140 |
|
| 141 |
@property |
| 142 |
def captcha(self): |
| 143 |
if self._captcha is None: |
| 144 |
from .captcha.client import AsyncCaptchaClient |
| 145 |
|
| 146 |
self._captcha = AsyncCaptchaClient(client_wrapper=self._client_wrapper) |
| 147 |
return self._captcha |
| 148 |
|
| 149 |
@property |
| 150 |
def phone_provider_protection(self): |
| 151 |
if self._phone_provider_protection is None: |
| 152 |
from .phone_provider_protection.client import AsyncPhoneProviderProtectionClient |
| 153 |
|
| 154 |
self._phone_provider_protection = AsyncPhoneProviderProtectionClient(client_wrapper=self._client_wrapper) |
| 155 |
return self._phone_provider_protection |
| 156 |
|
| 157 |
@property |
| 158 |
def suspicious_ip_throttling(self): |
| 159 |
if self._suspicious_ip_throttling is None: |
| 160 |
from .suspicious_ip_throttling.client import AsyncSuspiciousIpThrottlingClient |
| 161 |
|
| 162 |
self._suspicious_ip_throttling = AsyncSuspiciousIpThrottlingClient(client_wrapper=self._client_wrapper) |
| 163 |
return self._suspicious_ip_throttling |