| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ...core.request_options import RequestOptions |
| 7 |
from ...types.attack_protection_captcha_auth_challenge_request import AttackProtectionCaptchaAuthChallengeRequest |
| 8 |
from ...types.attack_protection_captcha_provider_id import AttackProtectionCaptchaProviderId |
| 9 |
from ...types.attack_protection_captcha_simple_captcha_response_content import ( |
| 10 |
AttackProtectionCaptchaSimpleCaptchaResponseContent, |
| 11 |
) |
| 12 |
from ...types.attack_protection_update_captcha_arkose import AttackProtectionUpdateCaptchaArkose |
| 13 |
from ...types.attack_protection_update_captcha_friendly_captcha import AttackProtectionUpdateCaptchaFriendlyCaptcha |
| 14 |
from ...types.attack_protection_update_captcha_hcaptcha import AttackProtectionUpdateCaptchaHcaptcha |
| 15 |
from ...types.attack_protection_update_captcha_recaptcha_enterprise import ( |
| 16 |
AttackProtectionUpdateCaptchaRecaptchaEnterprise, |
| 17 |
) |
| 18 |
from ...types.attack_protection_update_captcha_recaptcha_v_2 import AttackProtectionUpdateCaptchaRecaptchaV2 |
| 19 |
from ...types.get_attack_protection_captcha_response_content import GetAttackProtectionCaptchaResponseContent |
| 20 |
from ...types.update_attack_protection_captcha_response_content import UpdateAttackProtectionCaptchaResponseContent |
| 21 |
from .raw_client import AsyncRawCaptchaClient, RawCaptchaClient |
| 22 |
|
| 23 |
|
| 24 |
OMIT = typing.cast(typing.Any, ...) |
| 25 |
|
| 26 |
|
| 27 |
class CaptchaClient: |
| 28 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 29 |
self._raw_client = RawCaptchaClient(client_wrapper=client_wrapper) |
| 30 |
|
| 31 |
@property |
| 32 |
def with_raw_response(self) -> RawCaptchaClient: |
| 33 |
""" |
| 34 |
Retrieves a raw implementation of this client that returns raw responses. |
| 35 |
|
| 36 |
Returns |
| 37 |
------- |
| 38 |
RawCaptchaClient |
| 39 |
""" |
| 40 |
return self._raw_client |
| 41 |
|
| 42 |
def get( |
| 43 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 44 |
) -> GetAttackProtectionCaptchaResponseContent: |
| 45 |
""" |
| 46 |
Get the CAPTCHA configuration for your client. |
| 47 |
|
| 48 |
Parameters |
| 49 |
---------- |
| 50 |
request_options : typing.Optional[RequestOptions] |
| 51 |
Request-specific configuration. |
| 52 |
|
| 53 |
Returns |
| 54 |
------- |
| 55 |
GetAttackProtectionCaptchaResponseContent |
| 56 |
Captcha configuration successfully retrieved. |
| 57 |
|
| 58 |
Examples |
| 59 |
-------- |
| 60 |
from auth0 import Auth0 |
| 61 |
|
| 62 |
client = Auth0( |
| 63 |
token="YOUR_TOKEN", |
| 64 |
) |
| 65 |
client.attack_protection.captcha.get() |
| 66 |
""" |
| 67 |
_response = self._raw_client.get(request_options=request_options) |
| 68 |
return _response.data |
| 69 |
|
| 70 |
def update( |
| 71 |
self, |
| 72 |
*, |
| 73 |
active_provider_id: typing.Optional[AttackProtectionCaptchaProviderId] = OMIT, |
| 74 |
arkose: typing.Optional[AttackProtectionUpdateCaptchaArkose] = OMIT, |
| 75 |
auth_challenge: typing.Optional[AttackProtectionCaptchaAuthChallengeRequest] = OMIT, |
| 76 |
hcaptcha: typing.Optional[AttackProtectionUpdateCaptchaHcaptcha] = OMIT, |
| 77 |
friendly_captcha: typing.Optional[AttackProtectionUpdateCaptchaFriendlyCaptcha] = OMIT, |
| 78 |
recaptcha_enterprise: typing.Optional[AttackProtectionUpdateCaptchaRecaptchaEnterprise] = OMIT, |
| 79 |
recaptcha_v_2: typing.Optional[AttackProtectionUpdateCaptchaRecaptchaV2] = OMIT, |
| 80 |
simple_captcha: typing.Optional[AttackProtectionCaptchaSimpleCaptchaResponseContent] = OMIT, |
| 81 |
request_options: typing.Optional[RequestOptions] = None, |
| 82 |
) -> UpdateAttackProtectionCaptchaResponseContent: |
| 83 |
""" |
| 84 |
Update existing CAPTCHA configuration for your client. |
| 85 |
|
| 86 |
Parameters |
| 87 |
---------- |
| 88 |
active_provider_id : typing.Optional[AttackProtectionCaptchaProviderId] |
| 89 |
|
| 90 |
arkose : typing.Optional[AttackProtectionUpdateCaptchaArkose] |
| 91 |
|
| 92 |
auth_challenge : typing.Optional[AttackProtectionCaptchaAuthChallengeRequest] |
| 93 |
|
| 94 |
hcaptcha : typing.Optional[AttackProtectionUpdateCaptchaHcaptcha] |
| 95 |
|
| 96 |
friendly_captcha : typing.Optional[AttackProtectionUpdateCaptchaFriendlyCaptcha] |
| 97 |
|
| 98 |
recaptcha_enterprise : typing.Optional[AttackProtectionUpdateCaptchaRecaptchaEnterprise] |
| 99 |
|
| 100 |
recaptcha_v_2 : typing.Optional[AttackProtectionUpdateCaptchaRecaptchaV2] |
| 101 |
|
| 102 |
simple_captcha : typing.Optional[AttackProtectionCaptchaSimpleCaptchaResponseContent] |
| 103 |
|
| 104 |
request_options : typing.Optional[RequestOptions] |
| 105 |
Request-specific configuration. |
| 106 |
|
| 107 |
Returns |
| 108 |
------- |
| 109 |
UpdateAttackProtectionCaptchaResponseContent |
| 110 |
Captcha configuration successfully retrieved. |
| 111 |
|
| 112 |
Examples |
| 113 |
-------- |
| 114 |
from auth0 import Auth0 |
| 115 |
|
| 116 |
client = Auth0( |
| 117 |
token="YOUR_TOKEN", |
| 118 |
) |
| 119 |
client.attack_protection.captcha.update() |
| 120 |
""" |
| 121 |
_response = self._raw_client.update( |
| 122 |
active_provider_id=active_provider_id, |
| 123 |
arkose=arkose, |
| 124 |
auth_challenge=auth_challenge, |
| 125 |
hcaptcha=hcaptcha, |
| 126 |
friendly_captcha=friendly_captcha, |
| 127 |
recaptcha_enterprise=recaptcha_enterprise, |
| 128 |
recaptcha_v_2=recaptcha_v_2, |
| 129 |
simple_captcha=simple_captcha, |
| 130 |
request_options=request_options, |
| 131 |
) |
| 132 |
return _response.data |
| 133 |
|
| 134 |
|
| 135 |
class AsyncCaptchaClient: |
| 136 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 137 |
self._raw_client = AsyncRawCaptchaClient(client_wrapper=client_wrapper) |
| 138 |
|
| 139 |
@property |
| 140 |
def with_raw_response(self) -> AsyncRawCaptchaClient: |
| 141 |
""" |
| 142 |
Retrieves a raw implementation of this client that returns raw responses. |
| 143 |
|
| 144 |
Returns |
| 145 |
------- |
| 146 |
AsyncRawCaptchaClient |
| 147 |
""" |
| 148 |
return self._raw_client |
| 149 |
|
| 150 |
async def get( |
| 151 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 152 |
) -> GetAttackProtectionCaptchaResponseContent: |
| 153 |
""" |
| 154 |
Get the CAPTCHA configuration for your client. |
| 155 |
|
| 156 |
Parameters |
| 157 |
---------- |
| 158 |
request_options : typing.Optional[RequestOptions] |
| 159 |
Request-specific configuration. |
| 160 |
|
| 161 |
Returns |
| 162 |
------- |
| 163 |
GetAttackProtectionCaptchaResponseContent |
| 164 |
Captcha configuration successfully retrieved. |
| 165 |
|
| 166 |
Examples |
| 167 |
-------- |
| 168 |
import asyncio |
| 169 |
|
| 170 |
from auth0 import AsyncAuth0 |
| 171 |
|
| 172 |
client = AsyncAuth0( |
| 173 |
token="YOUR_TOKEN", |
| 174 |
) |
| 175 |
|
| 176 |
|
| 177 |
async def main() -> None: |
| 178 |
await client.attack_protection.captcha.get() |
| 179 |
|
| 180 |
|
| 181 |
asyncio.run(main()) |
| 182 |
""" |
| 183 |
_response = await self._raw_client.get(request_options=request_options) |
| 184 |
return _response.data |
| 185 |
|
| 186 |
async def update( |
| 187 |
self, |
| 188 |
*, |
| 189 |
active_provider_id: typing.Optional[AttackProtectionCaptchaProviderId] = OMIT, |
| 190 |
arkose: typing.Optional[AttackProtectionUpdateCaptchaArkose] = OMIT, |
| 191 |
auth_challenge: typing.Optional[AttackProtectionCaptchaAuthChallengeRequest] = OMIT, |
| 192 |
hcaptcha: typing.Optional[AttackProtectionUpdateCaptchaHcaptcha] = OMIT, |
| 193 |
friendly_captcha: typing.Optional[AttackProtectionUpdateCaptchaFriendlyCaptcha] = OMIT, |
| 194 |
recaptcha_enterprise: typing.Optional[AttackProtectionUpdateCaptchaRecaptchaEnterprise] = OMIT, |
| 195 |
recaptcha_v_2: typing.Optional[AttackProtectionUpdateCaptchaRecaptchaV2] = OMIT, |
| 196 |
simple_captcha: typing.Optional[AttackProtectionCaptchaSimpleCaptchaResponseContent] = OMIT, |
| 197 |
request_options: typing.Optional[RequestOptions] = None, |
| 198 |
) -> UpdateAttackProtectionCaptchaResponseContent: |
| 199 |
""" |
| 200 |
Update existing CAPTCHA configuration for your client. |
| 201 |
|
| 202 |
Parameters |
| 203 |
---------- |
| 204 |
active_provider_id : typing.Optional[AttackProtectionCaptchaProviderId] |
| 205 |
|
| 206 |
arkose : typing.Optional[AttackProtectionUpdateCaptchaArkose] |
| 207 |
|
| 208 |
auth_challenge : typing.Optional[AttackProtectionCaptchaAuthChallengeRequest] |
| 209 |
|
| 210 |
hcaptcha : typing.Optional[AttackProtectionUpdateCaptchaHcaptcha] |
| 211 |
|
| 212 |
friendly_captcha : typing.Optional[AttackProtectionUpdateCaptchaFriendlyCaptcha] |
| 213 |
|
| 214 |
recaptcha_enterprise : typing.Optional[AttackProtectionUpdateCaptchaRecaptchaEnterprise] |
| 215 |
|
| 216 |
recaptcha_v_2 : typing.Optional[AttackProtectionUpdateCaptchaRecaptchaV2] |
| 217 |
|
| 218 |
simple_captcha : typing.Optional[AttackProtectionCaptchaSimpleCaptchaResponseContent] |
| 219 |
|
| 220 |
request_options : typing.Optional[RequestOptions] |
| 221 |
Request-specific configuration. |
| 222 |
|
| 223 |
Returns |
| 224 |
------- |
| 225 |
UpdateAttackProtectionCaptchaResponseContent |
| 226 |
Captcha configuration successfully retrieved. |
| 227 |
|
| 228 |
Examples |
| 229 |
-------- |
| 230 |
import asyncio |
| 231 |
|
| 232 |
from auth0 import AsyncAuth0 |
| 233 |
|
| 234 |
client = AsyncAuth0( |
| 235 |
token="YOUR_TOKEN", |
| 236 |
) |
| 237 |
|
| 238 |
|
| 239 |
async def main() -> None: |
| 240 |
await client.attack_protection.captcha.update() |
| 241 |
|
| 242 |
|
| 243 |
asyncio.run(main()) |
| 244 |
""" |
| 245 |
_response = await self._raw_client.update( |
| 246 |
active_provider_id=active_provider_id, |
| 247 |
arkose=arkose, |
| 248 |
auth_challenge=auth_challenge, |
| 249 |
hcaptcha=hcaptcha, |
| 250 |
friendly_captcha=friendly_captcha, |
| 251 |
recaptcha_enterprise=recaptcha_enterprise, |
| 252 |
recaptcha_v_2=recaptcha_v_2, |
| 253 |
simple_captcha=simple_captcha, |
| 254 |
request_options=request_options, |
| 255 |
) |
| 256 |
return _response.data |