|
1 | 1 | import json |
2 | 2 | from typing import TYPE_CHECKING, Optional |
3 | | -from urllib.parse import quote |
| 3 | +from urllib.parse import quote, unquote |
4 | 4 |
|
5 | 5 | import httpx |
6 | | -from pydantic import ValidationError |
7 | | - |
8 | 6 | from auth0_server_python.auth_schemes.bearer_auth import BearerAuth |
9 | 7 | from auth0_server_python.auth_schemes.dpop_auth import DPoPAuth |
10 | 8 | from auth0_server_python.auth_types import ( |
@@ -416,7 +414,7 @@ async def get_factors( |
416 | 414 | return GetFactorsResponse.model_validate(response.json()) |
417 | 415 |
|
418 | 416 | except Exception as e: |
419 | | - if isinstance(e, (MyAccountApiError, ApiError, ValidationError)): |
| 417 | + if isinstance(e, (MyAccountApiError, ApiError)): |
420 | 418 | raise |
421 | 419 | raise ApiError( |
422 | 420 | "get_factors_error", |
@@ -464,7 +462,7 @@ async def list_authentication_methods( |
464 | 462 | return ListAuthenticationMethodsResponse.model_validate(response.json()) |
465 | 463 |
|
466 | 464 | except Exception as e: |
467 | | - if isinstance(e, (MyAccountApiError, ApiError, ValidationError)): |
| 465 | + if isinstance(e, (MyAccountApiError, ApiError)): |
468 | 466 | raise |
469 | 467 | raise ApiError( |
470 | 468 | "list_authentication_methods_error", |
@@ -509,7 +507,7 @@ async def get_authentication_method( |
509 | 507 | return AuthenticationMethod.model_validate(response.json()) |
510 | 508 |
|
511 | 509 | except Exception as e: |
512 | | - if isinstance(e, (MyAccountApiError, ApiError, ValidationError)): |
| 510 | + if isinstance(e, (MyAccountApiError, ApiError)): |
513 | 511 | raise |
514 | 512 | raise ApiError( |
515 | 513 | "get_authentication_method_error", |
@@ -552,7 +550,7 @@ async def delete_authentication_method( |
552 | 550 | ) |
553 | 551 |
|
554 | 552 | except Exception as e: |
555 | | - if isinstance(e, (MyAccountApiError, ApiError, ValidationError)): |
| 553 | + if isinstance(e, (MyAccountApiError, ApiError)): |
556 | 554 | raise |
557 | 555 | raise ApiError( |
558 | 556 | "delete_authentication_method_error", |
@@ -601,7 +599,7 @@ async def update_authentication_method( |
601 | 599 | return AuthenticationMethod.model_validate(response.json()) |
602 | 600 |
|
603 | 601 | except Exception as e: |
604 | | - if isinstance(e, (MyAccountApiError, ApiError, ValidationError)): |
| 602 | + if isinstance(e, (MyAccountApiError, ApiError)): |
605 | 603 | raise |
606 | 604 | raise ApiError( |
607 | 605 | "update_authentication_method_error", |
@@ -661,7 +659,7 @@ async def enroll_authentication_method( |
661 | 659 |
|
662 | 660 | path = location.split("?")[0].split("#")[0].rstrip("/") |
663 | 661 | segments = path.split("/") |
664 | | - authentication_method_id = segments[-1] if len(segments) > 1 else "" |
| 662 | + authentication_method_id = unquote(segments[-1]) if len(segments) > 1 else "" |
665 | 663 | if not authentication_method_id or authentication_method_id in ( |
666 | 664 | "authentication-methods", |
667 | 665 | "v1", |
@@ -696,7 +694,7 @@ async def enroll_authentication_method( |
696 | 694 | ) |
697 | 695 |
|
698 | 696 | except Exception as e: |
699 | | - if isinstance(e, (MyAccountApiError, ApiError, ValidationError)): |
| 697 | + if isinstance(e, (MyAccountApiError, ApiError)): |
700 | 698 | raise |
701 | 699 | raise ApiError( |
702 | 700 | "enroll_authentication_method_error", |
@@ -749,7 +747,7 @@ async def verify_authentication_method( |
749 | 747 | return AuthenticationMethod.model_validate(response.json()) |
750 | 748 |
|
751 | 749 | except Exception as e: |
752 | | - if isinstance(e, (MyAccountApiError, ApiError, ValidationError)): |
| 750 | + if isinstance(e, (MyAccountApiError, ApiError)): |
753 | 751 | raise |
754 | 752 | raise ApiError( |
755 | 753 | "verify_authentication_method_error", |
|
0 commit comments