| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ...core.request_options import RequestOptions |
| 7 |
from ...types.bot_detection_allowlist import BotDetectionAllowlist |
| 8 |
from ...types.bot_detection_challenge_policy_password_flow_enum import BotDetectionChallengePolicyPasswordFlowEnum |
| 9 |
from ...types.bot_detection_challenge_policy_password_reset_flow_enum import ( |
| 10 |
BotDetectionChallengePolicyPasswordResetFlowEnum, |
| 11 |
) |
| 12 |
from ...types.bot_detection_challenge_policy_passwordless_flow_enum import ( |
| 13 |
BotDetectionChallengePolicyPasswordlessFlowEnum, |
| 14 |
) |
| 15 |
from ...types.bot_detection_level_enum import BotDetectionLevelEnum |
| 16 |
from ...types.bot_detection_monitoring_mode_enabled import BotDetectionMonitoringModeEnabled |
| 17 |
from ...types.get_bot_detection_settings_response_content import GetBotDetectionSettingsResponseContent |
| 18 |
from ...types.update_bot_detection_settings_response_content import UpdateBotDetectionSettingsResponseContent |
| 19 |
from .raw_client import AsyncRawBotDetectionClient, RawBotDetectionClient |
| 20 |
|
| 21 |
|
| 22 |
OMIT = typing.cast(typing.Any, ...) |
| 23 |
|
| 24 |
|
| 25 |
class BotDetectionClient: |
| 26 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 27 |
self._raw_client = RawBotDetectionClient(client_wrapper=client_wrapper) |
| 28 |
|
| 29 |
@property |
| 30 |
def with_raw_response(self) -> RawBotDetectionClient: |
| 31 |
""" |
| 32 |
Retrieves a raw implementation of this client that returns raw responses. |
| 33 |
|
| 34 |
Returns |
| 35 |
------- |
| 36 |
RawBotDetectionClient |
| 37 |
""" |
| 38 |
return self._raw_client |
| 39 |
|
| 40 |
def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetBotDetectionSettingsResponseContent: |
| 41 |
""" |
| 42 |
Get the Bot Detection configuration of your tenant. |
| 43 |
|
| 44 |
Parameters |
| 45 |
---------- |
| 46 |
request_options : typing.Optional[RequestOptions] |
| 47 |
Request-specific configuration. |
| 48 |
|
| 49 |
Returns |
| 50 |
------- |
| 51 |
GetBotDetectionSettingsResponseContent |
| 52 |
Bot detection configuration retrieved successfully. |
| 53 |
|
| 54 |
Examples |
| 55 |
-------- |
| 56 |
from auth0 import Auth0 |
| 57 |
|
| 58 |
client = Auth0( |
| 59 |
token="YOUR_TOKEN", |
| 60 |
) |
| 61 |
client.attack_protection.bot_detection.get() |
| 62 |
""" |
| 63 |
_response = self._raw_client.get(request_options=request_options) |
| 64 |
return _response.data |
| 65 |
|
| 66 |
def update( |
| 67 |
self, |
| 68 |
*, |
| 69 |
bot_detection_level: typing.Optional[BotDetectionLevelEnum] = OMIT, |
| 70 |
challenge_password_policy: typing.Optional[BotDetectionChallengePolicyPasswordFlowEnum] = OMIT, |
| 71 |
challenge_passwordless_policy: typing.Optional[BotDetectionChallengePolicyPasswordlessFlowEnum] = OMIT, |
| 72 |
challenge_password_reset_policy: typing.Optional[BotDetectionChallengePolicyPasswordResetFlowEnum] = OMIT, |
| 73 |
allowlist: typing.Optional[BotDetectionAllowlist] = OMIT, |
| 74 |
monitoring_mode_enabled: typing.Optional[BotDetectionMonitoringModeEnabled] = OMIT, |
| 75 |
request_options: typing.Optional[RequestOptions] = None, |
| 76 |
) -> UpdateBotDetectionSettingsResponseContent: |
| 77 |
""" |
| 78 |
Update the Bot Detection configuration of your tenant. |
| 79 |
|
| 80 |
Parameters |
| 81 |
---------- |
| 82 |
bot_detection_level : typing.Optional[BotDetectionLevelEnum] |
| 83 |
|
| 84 |
challenge_password_policy : typing.Optional[BotDetectionChallengePolicyPasswordFlowEnum] |
| 85 |
|
| 86 |
challenge_passwordless_policy : typing.Optional[BotDetectionChallengePolicyPasswordlessFlowEnum] |
| 87 |
|
| 88 |
challenge_password_reset_policy : typing.Optional[BotDetectionChallengePolicyPasswordResetFlowEnum] |
| 89 |
|
| 90 |
allowlist : typing.Optional[BotDetectionAllowlist] |
| 91 |
|
| 92 |
monitoring_mode_enabled : typing.Optional[BotDetectionMonitoringModeEnabled] |
| 93 |
|
| 94 |
request_options : typing.Optional[RequestOptions] |
| 95 |
Request-specific configuration. |
| 96 |
|
| 97 |
Returns |
| 98 |
------- |
| 99 |
UpdateBotDetectionSettingsResponseContent |
| 100 |
Bot detection configuration successfully updated. |
| 101 |
|
| 102 |
Examples |
| 103 |
-------- |
| 104 |
from auth0 import Auth0 |
| 105 |
|
| 106 |
client = Auth0( |
| 107 |
token="YOUR_TOKEN", |
| 108 |
) |
| 109 |
client.attack_protection.bot_detection.update() |
| 110 |
""" |
| 111 |
_response = self._raw_client.update( |
| 112 |
bot_detection_level=bot_detection_level, |
| 113 |
challenge_password_policy=challenge_password_policy, |
| 114 |
challenge_passwordless_policy=challenge_passwordless_policy, |
| 115 |
challenge_password_reset_policy=challenge_password_reset_policy, |
| 116 |
allowlist=allowlist, |
| 117 |
monitoring_mode_enabled=monitoring_mode_enabled, |
| 118 |
request_options=request_options, |
| 119 |
) |
| 120 |
return _response.data |
| 121 |
|
| 122 |
|
| 123 |
class AsyncBotDetectionClient: |
| 124 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 125 |
self._raw_client = AsyncRawBotDetectionClient(client_wrapper=client_wrapper) |
| 126 |
|
| 127 |
@property |
| 128 |
def with_raw_response(self) -> AsyncRawBotDetectionClient: |
| 129 |
""" |
| 130 |
Retrieves a raw implementation of this client that returns raw responses. |
| 131 |
|
| 132 |
Returns |
| 133 |
------- |
| 134 |
AsyncRawBotDetectionClient |
| 135 |
""" |
| 136 |
return self._raw_client |
| 137 |
|
| 138 |
async def get( |
| 139 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 140 |
) -> GetBotDetectionSettingsResponseContent: |
| 141 |
""" |
| 142 |
Get the Bot Detection configuration of your tenant. |
| 143 |
|
| 144 |
Parameters |
| 145 |
---------- |
| 146 |
request_options : typing.Optional[RequestOptions] |
| 147 |
Request-specific configuration. |
| 148 |
|
| 149 |
Returns |
| 150 |
------- |
| 151 |
GetBotDetectionSettingsResponseContent |
| 152 |
Bot detection configuration retrieved successfully. |
| 153 |
|
| 154 |
Examples |
| 155 |
-------- |
| 156 |
import asyncio |
| 157 |
|
| 158 |
from auth0 import AsyncAuth0 |
| 159 |
|
| 160 |
client = AsyncAuth0( |
| 161 |
token="YOUR_TOKEN", |
| 162 |
) |
| 163 |
|
| 164 |
|
| 165 |
async def main() -> None: |
| 166 |
await client.attack_protection.bot_detection.get() |
| 167 |
|
| 168 |
|
| 169 |
asyncio.run(main()) |
| 170 |
""" |
| 171 |
_response = await self._raw_client.get(request_options=request_options) |
| 172 |
return _response.data |
| 173 |
|
| 174 |
async def update( |
| 175 |
self, |
| 176 |
*, |
| 177 |
bot_detection_level: typing.Optional[BotDetectionLevelEnum] = OMIT, |
| 178 |
challenge_password_policy: typing.Optional[BotDetectionChallengePolicyPasswordFlowEnum] = OMIT, |
| 179 |
challenge_passwordless_policy: typing.Optional[BotDetectionChallengePolicyPasswordlessFlowEnum] = OMIT, |
| 180 |
challenge_password_reset_policy: typing.Optional[BotDetectionChallengePolicyPasswordResetFlowEnum] = OMIT, |
| 181 |
allowlist: typing.Optional[BotDetectionAllowlist] = OMIT, |
| 182 |
monitoring_mode_enabled: typing.Optional[BotDetectionMonitoringModeEnabled] = OMIT, |
| 183 |
request_options: typing.Optional[RequestOptions] = None, |
| 184 |
) -> UpdateBotDetectionSettingsResponseContent: |
| 185 |
""" |
| 186 |
Update the Bot Detection configuration of your tenant. |
| 187 |
|
| 188 |
Parameters |
| 189 |
---------- |
| 190 |
bot_detection_level : typing.Optional[BotDetectionLevelEnum] |
| 191 |
|
| 192 |
challenge_password_policy : typing.Optional[BotDetectionChallengePolicyPasswordFlowEnum] |
| 193 |
|
| 194 |
challenge_passwordless_policy : typing.Optional[BotDetectionChallengePolicyPasswordlessFlowEnum] |
| 195 |
|
| 196 |
challenge_password_reset_policy : typing.Optional[BotDetectionChallengePolicyPasswordResetFlowEnum] |
| 197 |
|
| 198 |
allowlist : typing.Optional[BotDetectionAllowlist] |
| 199 |
|
| 200 |
monitoring_mode_enabled : typing.Optional[BotDetectionMonitoringModeEnabled] |
| 201 |
|
| 202 |
request_options : typing.Optional[RequestOptions] |
| 203 |
Request-specific configuration. |
| 204 |
|
| 205 |
Returns |
| 206 |
------- |
| 207 |
UpdateBotDetectionSettingsResponseContent |
| 208 |
Bot detection configuration successfully updated. |
| 209 |
|
| 210 |
Examples |
| 211 |
-------- |
| 212 |
import asyncio |
| 213 |
|
| 214 |
from auth0 import AsyncAuth0 |
| 215 |
|
| 216 |
client = AsyncAuth0( |
| 217 |
token="YOUR_TOKEN", |
| 218 |
) |
| 219 |
|
| 220 |
|
| 221 |
async def main() -> None: |
| 222 |
await client.attack_protection.bot_detection.update() |
| 223 |
|
| 224 |
|
| 225 |
asyncio.run(main()) |
| 226 |
""" |
| 227 |
_response = await self._raw_client.update( |
| 228 |
bot_detection_level=bot_detection_level, |
| 229 |
challenge_password_policy=challenge_password_policy, |
| 230 |
challenge_passwordless_policy=challenge_passwordless_policy, |
| 231 |
challenge_password_reset_policy=challenge_password_reset_policy, |
| 232 |
allowlist=allowlist, |
| 233 |
monitoring_mode_enabled=monitoring_mode_enabled, |
| 234 |
request_options=request_options, |
| 235 |
) |
| 236 |
return _response.data |