utils.aind_validators¶
validate_username ¶
Validates if the given username exists in the AIND Active Directory.
Queries the AIND metadata service to verify the username exists. Returns False (instead of raising) on network errors so callers can decide how to handle the degraded state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
The username to validate. |
required |
timeout
|
Optional[float]
|
Timeout in seconds for the HTTP request. Defaults to 2. |
2
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the username was found, False otherwise. |
Example
is_valid = validate_username("j.doe")
Source code in src/clabe/utils/aind_validators.py
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 | |
validate_rig_computer_name ¶
validate_rig_computer_name(rig: TRig) -> TRig
Ensures rig and computer name are set from environment variables if available, otherwise defaults to rig configuration values.
Source code in src/clabe/utils/aind_validators.py
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 | |