-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy pathclient.py
More file actions
996 lines (782 loc) · 39.9 KB
/
Copy pathclient.py
File metadata and controls
996 lines (782 loc) · 39.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
# This file was auto-generated by Fern from our API Definition.
from __future__ import annotations
import typing
import httpx
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .core.logging import LogConfig, Logger
from .environment import Auth0Environment
if typing.TYPE_CHECKING:
from .actions.client import ActionsClient, AsyncActionsClient
from .anomaly.client import AnomalyClient, AsyncAnomalyClient
from .attack_protection.client import AsyncAttackProtectionClient, AttackProtectionClient
from .branding.client import AsyncBrandingClient, BrandingClient
from .client_grants.client import AsyncClientGrantsClient, ClientGrantsClient
from .clients.client import AsyncClientsClient, ClientsClient
from .connection_profiles.client import AsyncConnectionProfilesClient, ConnectionProfilesClient
from .connections.client import AsyncConnectionsClient, ConnectionsClient
from .custom_domains.client import AsyncCustomDomainsClient, CustomDomainsClient
from .device_credentials.client import AsyncDeviceCredentialsClient, DeviceCredentialsClient
from .email_templates.client import AsyncEmailTemplatesClient, EmailTemplatesClient
from .emails.client import AsyncEmailsClient, EmailsClient
from .event_streams.client import AsyncEventStreamsClient, EventStreamsClient
from .flows.client import AsyncFlowsClient, FlowsClient
from .forms.client import AsyncFormsClient, FormsClient
from .groups.client import AsyncGroupsClient, GroupsClient
from .guardian.client import AsyncGuardianClient, GuardianClient
from .hooks.client import AsyncHooksClient, HooksClient
from .jobs.client import AsyncJobsClient, JobsClient
from .keys.client import AsyncKeysClient, KeysClient
from .log_streams.client import AsyncLogStreamsClient, LogStreamsClient
from .logs.client import AsyncLogsClient, LogsClient
from .network_acls.client import AsyncNetworkAclsClient, NetworkAclsClient
from .organizations.client import AsyncOrganizationsClient, OrganizationsClient
from .prompts.client import AsyncPromptsClient, PromptsClient
from .refresh_tokens.client import AsyncRefreshTokensClient, RefreshTokensClient
from .resource_servers.client import AsyncResourceServersClient, ResourceServersClient
from .risk_assessments.client import AsyncRiskAssessmentsClient, RiskAssessmentsClient
from .roles.client import AsyncRolesClient, RolesClient
from .rules.client import AsyncRulesClient, RulesClient
from .rules_configs.client import AsyncRulesConfigsClient, RulesConfigsClient
from .self_service_profiles.client import AsyncSelfServiceProfilesClient, SelfServiceProfilesClient
from .sessions.client import AsyncSessionsClient, SessionsClient
from .stats.client import AsyncStatsClient, StatsClient
from .supplemental_signals.client import AsyncSupplementalSignalsClient, SupplementalSignalsClient
from .tenants.client import AsyncTenantsClient, TenantsClient
from .tickets.client import AsyncTicketsClient, TicketsClient
from .token_exchange_profiles.client import AsyncTokenExchangeProfilesClient, TokenExchangeProfilesClient
from .user_attribute_profiles.client import AsyncUserAttributeProfilesClient, UserAttributeProfilesClient
from .user_blocks.client import AsyncUserBlocksClient, UserBlocksClient
from .user_grants.client import AsyncUserGrantsClient, UserGrantsClient
from .users.client import AsyncUsersClient, UsersClient
from .verifiable_credentials.client import AsyncVerifiableCredentialsClient, VerifiableCredentialsClient
class Auth0:
"""
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
Parameters
----------
base_url : typing.Optional[str]
The base url to use for requests from the client.
environment : Auth0Environment
The environment to use for requests from the client. from .environment import Auth0Environment
Defaults to Auth0Environment.DEFAULT
tenant_domain : typing.Optional[str]
Server URL variable for 'tenantDomain'. Defaults to '{TENANT}.auth0.com'.
token : typing.Union[str, typing.Callable[[], str]]
headers : typing.Optional[typing.Dict[str, str]]
Additional headers to send with every request.
timeout : typing.Optional[float]
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
follow_redirects : typing.Optional[bool]
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
httpx_client : typing.Optional[httpx.Client]
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
logging : typing.Optional[typing.Union[LogConfig, Logger]]
Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance.
Examples
--------
from auth0 import Auth0
client = Auth0(
token="YOUR_TOKEN",
)
"""
def __init__(
self,
*,
base_url: typing.Optional[str] = None,
environment: Auth0Environment = Auth0Environment.DEFAULT,
tenant_domain: typing.Optional[str] = None,
token: typing.Union[str, typing.Callable[[], str]],
headers: typing.Optional[typing.Dict[str, str]] = None,
timeout: typing.Optional[float] = None,
follow_redirects: typing.Optional[bool] = True,
httpx_client: typing.Optional[httpx.Client] = None,
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
):
_defaulted_timeout = (
timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
)
if tenant_domain is not None:
_tenant_domain = tenant_domain if tenant_domain is not None else "{TENANT}.auth0.com"
base_url = "https://{tenantDomain}/api/v2".format(tenantDomain=_tenant_domain)
self._client_wrapper = SyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
token=token,
headers=headers,
httpx_client=httpx_client
if httpx_client is not None
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
if follow_redirects is not None
else httpx.Client(timeout=_defaulted_timeout),
timeout=_defaulted_timeout,
logging=logging,
)
self._actions: typing.Optional[ActionsClient] = None
self._branding: typing.Optional[BrandingClient] = None
self._client_grants: typing.Optional[ClientGrantsClient] = None
self._clients: typing.Optional[ClientsClient] = None
self._connection_profiles: typing.Optional[ConnectionProfilesClient] = None
self._connections: typing.Optional[ConnectionsClient] = None
self._custom_domains: typing.Optional[CustomDomainsClient] = None
self._device_credentials: typing.Optional[DeviceCredentialsClient] = None
self._email_templates: typing.Optional[EmailTemplatesClient] = None
self._event_streams: typing.Optional[EventStreamsClient] = None
self._flows: typing.Optional[FlowsClient] = None
self._forms: typing.Optional[FormsClient] = None
self._user_grants: typing.Optional[UserGrantsClient] = None
self._groups: typing.Optional[GroupsClient] = None
self._hooks: typing.Optional[HooksClient] = None
self._jobs: typing.Optional[JobsClient] = None
self._log_streams: typing.Optional[LogStreamsClient] = None
self._logs: typing.Optional[LogsClient] = None
self._network_acls: typing.Optional[NetworkAclsClient] = None
self._organizations: typing.Optional[OrganizationsClient] = None
self._prompts: typing.Optional[PromptsClient] = None
self._refresh_tokens: typing.Optional[RefreshTokensClient] = None
self._resource_servers: typing.Optional[ResourceServersClient] = None
self._roles: typing.Optional[RolesClient] = None
self._rules: typing.Optional[RulesClient] = None
self._rules_configs: typing.Optional[RulesConfigsClient] = None
self._self_service_profiles: typing.Optional[SelfServiceProfilesClient] = None
self._sessions: typing.Optional[SessionsClient] = None
self._stats: typing.Optional[StatsClient] = None
self._supplemental_signals: typing.Optional[SupplementalSignalsClient] = None
self._tickets: typing.Optional[TicketsClient] = None
self._token_exchange_profiles: typing.Optional[TokenExchangeProfilesClient] = None
self._user_attribute_profiles: typing.Optional[UserAttributeProfilesClient] = None
self._user_blocks: typing.Optional[UserBlocksClient] = None
self._users: typing.Optional[UsersClient] = None
self._anomaly: typing.Optional[AnomalyClient] = None
self._attack_protection: typing.Optional[AttackProtectionClient] = None
self._emails: typing.Optional[EmailsClient] = None
self._guardian: typing.Optional[GuardianClient] = None
self._keys: typing.Optional[KeysClient] = None
self._risk_assessments: typing.Optional[RiskAssessmentsClient] = None
self._tenants: typing.Optional[TenantsClient] = None
self._verifiable_credentials: typing.Optional[VerifiableCredentialsClient] = None
@property
def actions(self):
if self._actions is None:
from .actions.client import ActionsClient # noqa: E402
self._actions = ActionsClient(client_wrapper=self._client_wrapper)
return self._actions
@property
def branding(self):
if self._branding is None:
from .branding.client import BrandingClient # noqa: E402
self._branding = BrandingClient(client_wrapper=self._client_wrapper)
return self._branding
@property
def client_grants(self):
if self._client_grants is None:
from .client_grants.client import ClientGrantsClient # noqa: E402
self._client_grants = ClientGrantsClient(client_wrapper=self._client_wrapper)
return self._client_grants
@property
def clients(self):
if self._clients is None:
from .clients.client import ClientsClient # noqa: E402
self._clients = ClientsClient(client_wrapper=self._client_wrapper)
return self._clients
@property
def connection_profiles(self):
if self._connection_profiles is None:
from .connection_profiles.client import ConnectionProfilesClient # noqa: E402
self._connection_profiles = ConnectionProfilesClient(client_wrapper=self._client_wrapper)
return self._connection_profiles
@property
def connections(self):
if self._connections is None:
from .connections.client import ConnectionsClient # noqa: E402
self._connections = ConnectionsClient(client_wrapper=self._client_wrapper)
return self._connections
@property
def custom_domains(self):
if self._custom_domains is None:
from .custom_domains.client import CustomDomainsClient # noqa: E402
self._custom_domains = CustomDomainsClient(client_wrapper=self._client_wrapper)
return self._custom_domains
@property
def device_credentials(self):
if self._device_credentials is None:
from .device_credentials.client import DeviceCredentialsClient # noqa: E402
self._device_credentials = DeviceCredentialsClient(client_wrapper=self._client_wrapper)
return self._device_credentials
@property
def email_templates(self):
if self._email_templates is None:
from .email_templates.client import EmailTemplatesClient # noqa: E402
self._email_templates = EmailTemplatesClient(client_wrapper=self._client_wrapper)
return self._email_templates
@property
def event_streams(self):
if self._event_streams is None:
from .event_streams.client import EventStreamsClient # noqa: E402
self._event_streams = EventStreamsClient(client_wrapper=self._client_wrapper)
return self._event_streams
@property
def flows(self):
if self._flows is None:
from .flows.client import FlowsClient # noqa: E402
self._flows = FlowsClient(client_wrapper=self._client_wrapper)
return self._flows
@property
def forms(self):
if self._forms is None:
from .forms.client import FormsClient # noqa: E402
self._forms = FormsClient(client_wrapper=self._client_wrapper)
return self._forms
@property
def user_grants(self):
if self._user_grants is None:
from .user_grants.client import UserGrantsClient # noqa: E402
self._user_grants = UserGrantsClient(client_wrapper=self._client_wrapper)
return self._user_grants
@property
def groups(self):
if self._groups is None:
from .groups.client import GroupsClient # noqa: E402
self._groups = GroupsClient(client_wrapper=self._client_wrapper)
return self._groups
@property
def hooks(self):
if self._hooks is None:
from .hooks.client import HooksClient # noqa: E402
self._hooks = HooksClient(client_wrapper=self._client_wrapper)
return self._hooks
@property
def jobs(self):
if self._jobs is None:
from .jobs.client import JobsClient # noqa: E402
self._jobs = JobsClient(client_wrapper=self._client_wrapper)
return self._jobs
@property
def log_streams(self):
if self._log_streams is None:
from .log_streams.client import LogStreamsClient # noqa: E402
self._log_streams = LogStreamsClient(client_wrapper=self._client_wrapper)
return self._log_streams
@property
def logs(self):
if self._logs is None:
from .logs.client import LogsClient # noqa: E402
self._logs = LogsClient(client_wrapper=self._client_wrapper)
return self._logs
@property
def network_acls(self):
if self._network_acls is None:
from .network_acls.client import NetworkAclsClient # noqa: E402
self._network_acls = NetworkAclsClient(client_wrapper=self._client_wrapper)
return self._network_acls
@property
def organizations(self):
if self._organizations is None:
from .organizations.client import OrganizationsClient # noqa: E402
self._organizations = OrganizationsClient(client_wrapper=self._client_wrapper)
return self._organizations
@property
def prompts(self):
if self._prompts is None:
from .prompts.client import PromptsClient # noqa: E402
self._prompts = PromptsClient(client_wrapper=self._client_wrapper)
return self._prompts
@property
def refresh_tokens(self):
if self._refresh_tokens is None:
from .refresh_tokens.client import RefreshTokensClient # noqa: E402
self._refresh_tokens = RefreshTokensClient(client_wrapper=self._client_wrapper)
return self._refresh_tokens
@property
def resource_servers(self):
if self._resource_servers is None:
from .resource_servers.client import ResourceServersClient # noqa: E402
self._resource_servers = ResourceServersClient(client_wrapper=self._client_wrapper)
return self._resource_servers
@property
def roles(self):
if self._roles is None:
from .roles.client import RolesClient # noqa: E402
self._roles = RolesClient(client_wrapper=self._client_wrapper)
return self._roles
@property
def rules(self):
if self._rules is None:
from .rules.client import RulesClient # noqa: E402
self._rules = RulesClient(client_wrapper=self._client_wrapper)
return self._rules
@property
def rules_configs(self):
if self._rules_configs is None:
from .rules_configs.client import RulesConfigsClient # noqa: E402
self._rules_configs = RulesConfigsClient(client_wrapper=self._client_wrapper)
return self._rules_configs
@property
def self_service_profiles(self):
if self._self_service_profiles is None:
from .self_service_profiles.client import SelfServiceProfilesClient # noqa: E402
self._self_service_profiles = SelfServiceProfilesClient(client_wrapper=self._client_wrapper)
return self._self_service_profiles
@property
def sessions(self):
if self._sessions is None:
from .sessions.client import SessionsClient # noqa: E402
self._sessions = SessionsClient(client_wrapper=self._client_wrapper)
return self._sessions
@property
def stats(self):
if self._stats is None:
from .stats.client import StatsClient # noqa: E402
self._stats = StatsClient(client_wrapper=self._client_wrapper)
return self._stats
@property
def supplemental_signals(self):
if self._supplemental_signals is None:
from .supplemental_signals.client import SupplementalSignalsClient # noqa: E402
self._supplemental_signals = SupplementalSignalsClient(client_wrapper=self._client_wrapper)
return self._supplemental_signals
@property
def tickets(self):
if self._tickets is None:
from .tickets.client import TicketsClient # noqa: E402
self._tickets = TicketsClient(client_wrapper=self._client_wrapper)
return self._tickets
@property
def token_exchange_profiles(self):
if self._token_exchange_profiles is None:
from .token_exchange_profiles.client import TokenExchangeProfilesClient # noqa: E402
self._token_exchange_profiles = TokenExchangeProfilesClient(client_wrapper=self._client_wrapper)
return self._token_exchange_profiles
@property
def user_attribute_profiles(self):
if self._user_attribute_profiles is None:
from .user_attribute_profiles.client import UserAttributeProfilesClient # noqa: E402
self._user_attribute_profiles = UserAttributeProfilesClient(client_wrapper=self._client_wrapper)
return self._user_attribute_profiles
@property
def user_blocks(self):
if self._user_blocks is None:
from .user_blocks.client import UserBlocksClient # noqa: E402
self._user_blocks = UserBlocksClient(client_wrapper=self._client_wrapper)
return self._user_blocks
@property
def users(self):
if self._users is None:
from .users.client import UsersClient # noqa: E402
self._users = UsersClient(client_wrapper=self._client_wrapper)
return self._users
@property
def anomaly(self):
if self._anomaly is None:
from .anomaly.client import AnomalyClient # noqa: E402
self._anomaly = AnomalyClient(client_wrapper=self._client_wrapper)
return self._anomaly
@property
def attack_protection(self):
if self._attack_protection is None:
from .attack_protection.client import AttackProtectionClient # noqa: E402
self._attack_protection = AttackProtectionClient(client_wrapper=self._client_wrapper)
return self._attack_protection
@property
def emails(self):
if self._emails is None:
from .emails.client import EmailsClient # noqa: E402
self._emails = EmailsClient(client_wrapper=self._client_wrapper)
return self._emails
@property
def guardian(self):
if self._guardian is None:
from .guardian.client import GuardianClient # noqa: E402
self._guardian = GuardianClient(client_wrapper=self._client_wrapper)
return self._guardian
@property
def keys(self):
if self._keys is None:
from .keys.client import KeysClient # noqa: E402
self._keys = KeysClient(client_wrapper=self._client_wrapper)
return self._keys
@property
def risk_assessments(self):
if self._risk_assessments is None:
from .risk_assessments.client import RiskAssessmentsClient # noqa: E402
self._risk_assessments = RiskAssessmentsClient(client_wrapper=self._client_wrapper)
return self._risk_assessments
@property
def tenants(self):
if self._tenants is None:
from .tenants.client import TenantsClient # noqa: E402
self._tenants = TenantsClient(client_wrapper=self._client_wrapper)
return self._tenants
@property
def verifiable_credentials(self):
if self._verifiable_credentials is None:
from .verifiable_credentials.client import VerifiableCredentialsClient # noqa: E402
self._verifiable_credentials = VerifiableCredentialsClient(client_wrapper=self._client_wrapper)
return self._verifiable_credentials
class AsyncAuth0:
"""
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
Parameters
----------
base_url : typing.Optional[str]
The base url to use for requests from the client.
environment : Auth0Environment
The environment to use for requests from the client. from .environment import Auth0Environment
Defaults to Auth0Environment.DEFAULT
tenant_domain : typing.Optional[str]
Server URL variable for 'tenantDomain'. Defaults to '{TENANT}.auth0.com'.
token : typing.Union[str, typing.Callable[[], str]]
headers : typing.Optional[typing.Dict[str, str]]
Additional headers to send with every request.
timeout : typing.Optional[float]
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
follow_redirects : typing.Optional[bool]
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
httpx_client : typing.Optional[httpx.AsyncClient]
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
logging : typing.Optional[typing.Union[LogConfig, Logger]]
Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance.
Examples
--------
from auth0 import AsyncAuth0
client = AsyncAuth0(
token="YOUR_TOKEN",
)
"""
def __init__(
self,
*,
base_url: typing.Optional[str] = None,
environment: Auth0Environment = Auth0Environment.DEFAULT,
tenant_domain: typing.Optional[str] = None,
token: typing.Union[str, typing.Callable[[], str]],
headers: typing.Optional[typing.Dict[str, str]] = None,
timeout: typing.Optional[float] = None,
follow_redirects: typing.Optional[bool] = True,
httpx_client: typing.Optional[httpx.AsyncClient] = None,
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
):
_defaulted_timeout = (
timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
)
if tenant_domain is not None:
_tenant_domain = tenant_domain if tenant_domain is not None else "{TENANT}.auth0.com"
base_url = "https://{tenantDomain}/api/v2".format(tenantDomain=_tenant_domain)
self._client_wrapper = AsyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
token=token,
headers=headers,
httpx_client=httpx_client
if httpx_client is not None
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
if follow_redirects is not None
else httpx.AsyncClient(timeout=_defaulted_timeout),
timeout=_defaulted_timeout,
logging=logging,
)
self._actions: typing.Optional[AsyncActionsClient] = None
self._branding: typing.Optional[AsyncBrandingClient] = None
self._client_grants: typing.Optional[AsyncClientGrantsClient] = None
self._clients: typing.Optional[AsyncClientsClient] = None
self._connection_profiles: typing.Optional[AsyncConnectionProfilesClient] = None
self._connections: typing.Optional[AsyncConnectionsClient] = None
self._custom_domains: typing.Optional[AsyncCustomDomainsClient] = None
self._device_credentials: typing.Optional[AsyncDeviceCredentialsClient] = None
self._email_templates: typing.Optional[AsyncEmailTemplatesClient] = None
self._event_streams: typing.Optional[AsyncEventStreamsClient] = None
self._flows: typing.Optional[AsyncFlowsClient] = None
self._forms: typing.Optional[AsyncFormsClient] = None
self._user_grants: typing.Optional[AsyncUserGrantsClient] = None
self._groups: typing.Optional[AsyncGroupsClient] = None
self._hooks: typing.Optional[AsyncHooksClient] = None
self._jobs: typing.Optional[AsyncJobsClient] = None
self._log_streams: typing.Optional[AsyncLogStreamsClient] = None
self._logs: typing.Optional[AsyncLogsClient] = None
self._network_acls: typing.Optional[AsyncNetworkAclsClient] = None
self._organizations: typing.Optional[AsyncOrganizationsClient] = None
self._prompts: typing.Optional[AsyncPromptsClient] = None
self._refresh_tokens: typing.Optional[AsyncRefreshTokensClient] = None
self._resource_servers: typing.Optional[AsyncResourceServersClient] = None
self._roles: typing.Optional[AsyncRolesClient] = None
self._rules: typing.Optional[AsyncRulesClient] = None
self._rules_configs: typing.Optional[AsyncRulesConfigsClient] = None
self._self_service_profiles: typing.Optional[AsyncSelfServiceProfilesClient] = None
self._sessions: typing.Optional[AsyncSessionsClient] = None
self._stats: typing.Optional[AsyncStatsClient] = None
self._supplemental_signals: typing.Optional[AsyncSupplementalSignalsClient] = None
self._tickets: typing.Optional[AsyncTicketsClient] = None
self._token_exchange_profiles: typing.Optional[AsyncTokenExchangeProfilesClient] = None
self._user_attribute_profiles: typing.Optional[AsyncUserAttributeProfilesClient] = None
self._user_blocks: typing.Optional[AsyncUserBlocksClient] = None
self._users: typing.Optional[AsyncUsersClient] = None
self._anomaly: typing.Optional[AsyncAnomalyClient] = None
self._attack_protection: typing.Optional[AsyncAttackProtectionClient] = None
self._emails: typing.Optional[AsyncEmailsClient] = None
self._guardian: typing.Optional[AsyncGuardianClient] = None
self._keys: typing.Optional[AsyncKeysClient] = None
self._risk_assessments: typing.Optional[AsyncRiskAssessmentsClient] = None
self._tenants: typing.Optional[AsyncTenantsClient] = None
self._verifiable_credentials: typing.Optional[AsyncVerifiableCredentialsClient] = None
@property
def actions(self):
if self._actions is None:
from .actions.client import AsyncActionsClient # noqa: E402
self._actions = AsyncActionsClient(client_wrapper=self._client_wrapper)
return self._actions
@property
def branding(self):
if self._branding is None:
from .branding.client import AsyncBrandingClient # noqa: E402
self._branding = AsyncBrandingClient(client_wrapper=self._client_wrapper)
return self._branding
@property
def client_grants(self):
if self._client_grants is None:
from .client_grants.client import AsyncClientGrantsClient # noqa: E402
self._client_grants = AsyncClientGrantsClient(client_wrapper=self._client_wrapper)
return self._client_grants
@property
def clients(self):
if self._clients is None:
from .clients.client import AsyncClientsClient # noqa: E402
self._clients = AsyncClientsClient(client_wrapper=self._client_wrapper)
return self._clients
@property
def connection_profiles(self):
if self._connection_profiles is None:
from .connection_profiles.client import AsyncConnectionProfilesClient # noqa: E402
self._connection_profiles = AsyncConnectionProfilesClient(client_wrapper=self._client_wrapper)
return self._connection_profiles
@property
def connections(self):
if self._connections is None:
from .connections.client import AsyncConnectionsClient # noqa: E402
self._connections = AsyncConnectionsClient(client_wrapper=self._client_wrapper)
return self._connections
@property
def custom_domains(self):
if self._custom_domains is None:
from .custom_domains.client import AsyncCustomDomainsClient # noqa: E402
self._custom_domains = AsyncCustomDomainsClient(client_wrapper=self._client_wrapper)
return self._custom_domains
@property
def device_credentials(self):
if self._device_credentials is None:
from .device_credentials.client import AsyncDeviceCredentialsClient # noqa: E402
self._device_credentials = AsyncDeviceCredentialsClient(client_wrapper=self._client_wrapper)
return self._device_credentials
@property
def email_templates(self):
if self._email_templates is None:
from .email_templates.client import AsyncEmailTemplatesClient # noqa: E402
self._email_templates = AsyncEmailTemplatesClient(client_wrapper=self._client_wrapper)
return self._email_templates
@property
def event_streams(self):
if self._event_streams is None:
from .event_streams.client import AsyncEventStreamsClient # noqa: E402
self._event_streams = AsyncEventStreamsClient(client_wrapper=self._client_wrapper)
return self._event_streams
@property
def flows(self):
if self._flows is None:
from .flows.client import AsyncFlowsClient # noqa: E402
self._flows = AsyncFlowsClient(client_wrapper=self._client_wrapper)
return self._flows
@property
def forms(self):
if self._forms is None:
from .forms.client import AsyncFormsClient # noqa: E402
self._forms = AsyncFormsClient(client_wrapper=self._client_wrapper)
return self._forms
@property
def user_grants(self):
if self._user_grants is None:
from .user_grants.client import AsyncUserGrantsClient # noqa: E402
self._user_grants = AsyncUserGrantsClient(client_wrapper=self._client_wrapper)
return self._user_grants
@property
def groups(self):
if self._groups is None:
from .groups.client import AsyncGroupsClient # noqa: E402
self._groups = AsyncGroupsClient(client_wrapper=self._client_wrapper)
return self._groups
@property
def hooks(self):
if self._hooks is None:
from .hooks.client import AsyncHooksClient # noqa: E402
self._hooks = AsyncHooksClient(client_wrapper=self._client_wrapper)
return self._hooks
@property
def jobs(self):
if self._jobs is None:
from .jobs.client import AsyncJobsClient # noqa: E402
self._jobs = AsyncJobsClient(client_wrapper=self._client_wrapper)
return self._jobs
@property
def log_streams(self):
if self._log_streams is None:
from .log_streams.client import AsyncLogStreamsClient # noqa: E402
self._log_streams = AsyncLogStreamsClient(client_wrapper=self._client_wrapper)
return self._log_streams
@property
def logs(self):
if self._logs is None:
from .logs.client import AsyncLogsClient # noqa: E402
self._logs = AsyncLogsClient(client_wrapper=self._client_wrapper)
return self._logs
@property
def network_acls(self):
if self._network_acls is None:
from .network_acls.client import AsyncNetworkAclsClient # noqa: E402
self._network_acls = AsyncNetworkAclsClient(client_wrapper=self._client_wrapper)
return self._network_acls
@property
def organizations(self):
if self._organizations is None:
from .organizations.client import AsyncOrganizationsClient # noqa: E402
self._organizations = AsyncOrganizationsClient(client_wrapper=self._client_wrapper)
return self._organizations
@property
def prompts(self):
if self._prompts is None:
from .prompts.client import AsyncPromptsClient # noqa: E402
self._prompts = AsyncPromptsClient(client_wrapper=self._client_wrapper)
return self._prompts
@property
def refresh_tokens(self):
if self._refresh_tokens is None:
from .refresh_tokens.client import AsyncRefreshTokensClient # noqa: E402
self._refresh_tokens = AsyncRefreshTokensClient(client_wrapper=self._client_wrapper)
return self._refresh_tokens
@property
def resource_servers(self):
if self._resource_servers is None:
from .resource_servers.client import AsyncResourceServersClient # noqa: E402
self._resource_servers = AsyncResourceServersClient(client_wrapper=self._client_wrapper)
return self._resource_servers
@property
def roles(self):
if self._roles is None:
from .roles.client import AsyncRolesClient # noqa: E402
self._roles = AsyncRolesClient(client_wrapper=self._client_wrapper)
return self._roles
@property
def rules(self):
if self._rules is None:
from .rules.client import AsyncRulesClient # noqa: E402
self._rules = AsyncRulesClient(client_wrapper=self._client_wrapper)
return self._rules
@property
def rules_configs(self):
if self._rules_configs is None:
from .rules_configs.client import AsyncRulesConfigsClient # noqa: E402
self._rules_configs = AsyncRulesConfigsClient(client_wrapper=self._client_wrapper)
return self._rules_configs
@property
def self_service_profiles(self):
if self._self_service_profiles is None:
from .self_service_profiles.client import AsyncSelfServiceProfilesClient # noqa: E402
self._self_service_profiles = AsyncSelfServiceProfilesClient(client_wrapper=self._client_wrapper)
return self._self_service_profiles
@property
def sessions(self):
if self._sessions is None:
from .sessions.client import AsyncSessionsClient # noqa: E402
self._sessions = AsyncSessionsClient(client_wrapper=self._client_wrapper)
return self._sessions
@property
def stats(self):
if self._stats is None:
from .stats.client import AsyncStatsClient # noqa: E402
self._stats = AsyncStatsClient(client_wrapper=self._client_wrapper)
return self._stats
@property
def supplemental_signals(self):
if self._supplemental_signals is None:
from .supplemental_signals.client import AsyncSupplementalSignalsClient # noqa: E402
self._supplemental_signals = AsyncSupplementalSignalsClient(client_wrapper=self._client_wrapper)
return self._supplemental_signals
@property
def tickets(self):
if self._tickets is None:
from .tickets.client import AsyncTicketsClient # noqa: E402
self._tickets = AsyncTicketsClient(client_wrapper=self._client_wrapper)
return self._tickets
@property
def token_exchange_profiles(self):
if self._token_exchange_profiles is None:
from .token_exchange_profiles.client import AsyncTokenExchangeProfilesClient # noqa: E402
self._token_exchange_profiles = AsyncTokenExchangeProfilesClient(client_wrapper=self._client_wrapper)
return self._token_exchange_profiles
@property
def user_attribute_profiles(self):
if self._user_attribute_profiles is None:
from .user_attribute_profiles.client import AsyncUserAttributeProfilesClient # noqa: E402
self._user_attribute_profiles = AsyncUserAttributeProfilesClient(client_wrapper=self._client_wrapper)
return self._user_attribute_profiles
@property
def user_blocks(self):
if self._user_blocks is None:
from .user_blocks.client import AsyncUserBlocksClient # noqa: E402
self._user_blocks = AsyncUserBlocksClient(client_wrapper=self._client_wrapper)
return self._user_blocks
@property
def users(self):
if self._users is None:
from .users.client import AsyncUsersClient # noqa: E402
self._users = AsyncUsersClient(client_wrapper=self._client_wrapper)
return self._users
@property
def anomaly(self):
if self._anomaly is None:
from .anomaly.client import AsyncAnomalyClient # noqa: E402
self._anomaly = AsyncAnomalyClient(client_wrapper=self._client_wrapper)
return self._anomaly
@property
def attack_protection(self):
if self._attack_protection is None:
from .attack_protection.client import AsyncAttackProtectionClient # noqa: E402
self._attack_protection = AsyncAttackProtectionClient(client_wrapper=self._client_wrapper)
return self._attack_protection
@property
def emails(self):
if self._emails is None:
from .emails.client import AsyncEmailsClient # noqa: E402
self._emails = AsyncEmailsClient(client_wrapper=self._client_wrapper)
return self._emails
@property
def guardian(self):
if self._guardian is None:
from .guardian.client import AsyncGuardianClient # noqa: E402
self._guardian = AsyncGuardianClient(client_wrapper=self._client_wrapper)
return self._guardian
@property
def keys(self):
if self._keys is None:
from .keys.client import AsyncKeysClient # noqa: E402
self._keys = AsyncKeysClient(client_wrapper=self._client_wrapper)
return self._keys
@property
def risk_assessments(self):
if self._risk_assessments is None:
from .risk_assessments.client import AsyncRiskAssessmentsClient # noqa: E402
self._risk_assessments = AsyncRiskAssessmentsClient(client_wrapper=self._client_wrapper)
return self._risk_assessments
@property
def tenants(self):
if self._tenants is None:
from .tenants.client import AsyncTenantsClient # noqa: E402
self._tenants = AsyncTenantsClient(client_wrapper=self._client_wrapper)
return self._tenants
@property
def verifiable_credentials(self):
if self._verifiable_credentials is None:
from .verifiable_credentials.client import AsyncVerifiableCredentialsClient # noqa: E402
self._verifiable_credentials = AsyncVerifiableCredentialsClient(client_wrapper=self._client_wrapper)
return self._verifiable_credentials
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: Auth0Environment) -> str:
if base_url is not None:
return base_url
elif environment is not None:
return environment.value
else:
raise Exception("Please pass in either base_url or environment to construct the client")