Maestro config
dadosfera.services.maestro.get_user_config
get_user_config(maestro_base_url, email, password, totp=None)
Authenticate and retrieve user configuration from Maestro.
Performs authentication against the Maestro API and returns comprehensive user configuration including permissions, tokens, MFA status, terms of use status, user details, and customer information.
PARAMETER | DESCRIPTION |
---|---|
maestro_base_url
|
Base URL of the Maestro instance (e.g., 'https://maestro.example.com/api').
TYPE:
|
email
|
User's email address for authentication.
TYPE:
|
password
|
User's password for authentication.
TYPE:
|
totp
|
Time-based One-Time Password for two-factor authentication. Required if 2FA is enabled for the user. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
json
|
Dict[str, Any]: User configuration containing: - permissions (List[str]): List of user's access permissions - tokens (Dict[str, str]): Authentication tokens including: - idToken: Identity token - accessToken: API access token - refreshToken: Token for refreshing access - mfaStatus (str): Multi-factor authentication status - termsOfUse (Dict): Terms of use acceptance status including: - status (str): Current status - lastSigned (Dict): Details of last terms acceptance - version (int): Terms version number - publicUrl (str): URL to terms document - enforceDate (str): Enforcement date - createdAt (str): Creation timestamp - user (Dict): User profile information: - id (str): Unique user identifier - name (str): Full name - username (str): Username - createdAt (str): Account creation timestamp - customer (Dict): Customer account details: - modules (List[str]): Enabled product modules - links (List[Dict]): Custom dashboard links - id (str): Customer account ID - name (str): Customer account name - tier (str): Subscription tier - scheduleLimit (str): Pipeline schedule frequency limit |
RAISES | DESCRIPTION |
---|---|
HTTPError
|
For failed API requests. Common cases: - 401: Invalid or expired token - 403: Insufficient permissions |
ConnectionError
|
For network connectivity issues |
Timeout
|
For request timeouts |
RequestException
|
For other request-related errors |
ValueError
|
If provided credentials are invalid |
AuthenticationError
|
If authentication fails (invalid email/password/TOTP) |
Example
config = get_user_config( ... maestro_base_url="https://maestro.example.com/api", ... email="user@example.com", ... password="secure_password" ... )
Check user permissions
if "catalog:edit" in config["permissions"]: ... logger.info("User can edit catalog") User can edit catalog
Access API token
token = config["tokens"]["accessToken"] logger.info(f"Token: {token[:10]}...") Token: random-tok...
Get customer tier
logger.info(f"Account tier: {config['customer']['tier']}") Account tier: STANDARD
Source code in dadosfera/services/maestro/maestro_config.py
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 |
|
dadosfera.services.maestro.get_token
get_token(maestro_base_url, email, password, totp=None)
Authenticate with Maestro using given credentials and return the authentication token.
PARAMETER | DESCRIPTION |
---|---|
maestro_base_url
|
Base URL of the Maestro instance (e.g., 'https://maestro.example.com/api').
TYPE:
|
email
|
User's email address for authentication.
TYPE:
|
password
|
User's password for authentication.
TYPE:
|
totp
|
Time-based One-Time Password for two-factor authentication. Required if 2FA is enabled for the user. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
token
|
Authentication token for API access.
TYPE:
|
Example: >>> token = get_token( ... maestro_base_url="https://maestro.example.com/api", ... email="user@example.com", ... password="secure_password" ... ) >>> logger.info(f"Token: {token[:10]}...") Token: random-tok...
Source code in dadosfera/services/maestro/maestro_config.py
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 |
|