Authentication¶
ineepy uses JWT (JSON Web Token) authentication. Before using the client, you must obtain a token from the ineep server using your credentials.
Obtaining a token¶
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
email |
str |
required | Email address for authentication |
password |
str |
required | Password |
scopes |
str or iterable of str |
('user',) |
See Scopes |
base_url |
str |
from config | Base URL of the ineep server |
api_path |
str |
from config | API path (default: /api/v0) |
config_file |
str or Path |
'ineepy.toml' |
Path to config file |
save_token |
bool |
True |
Automatically save token to config file |
Scopes¶
Scopes restrict what a user can access. Always request only the minimum scopes needed for your task. This follows the principle of least privilege and reduces security risks.
Four scopes are available:
| Scope | Capabilities |
|---|---|
'user' |
Access own profile and API keys |
'admin' |
Full administrative access: manage users |
'viewer' |
Visualization access to namespaces, tables and datasets |
'editor' |
Edition access to namespaces, tables and datasets |
Configuration file¶
The ineepy.toml file stores your authentication state:
base_url = "https://ineep-lakehouse-prod.exe.xyz"
api_path = "/api/v0"
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
This file is created automatically in the current working directory when you call get_token().
Manual configuration¶
If you already have a valid token you can create ineepy.toml manually to avoid calling get_token() every time:
cat > ineepy.toml <<EOF
base_url = "https://my-ineep.example.com"
api_path = "/api/v0"
token = "your-jwt-token-here"
EOF
Then use the client without passing a token:
from ineepy import Ineepy
with Ineepy() as client:
user, etag = client.users.get('me')
print(f'Logged in as: {user.email}')
Token persistence¶
By default, get_token() writes the token to ineepy.toml for reuse.
To disable automatic saving, use save_token=False:
from ineepy import Ineepy, get_token
token = get_token(
email='user@ineep.org.br',
password='Secret123',
save_token=False,
)
with Ineepy(token=token) as client:
user, etag = client.users.get('me')
print(f'Logged in as: {user.email}')
Environment variables¶
You can also load token and server URL from environment variables:
export INEEPY_BASE_URL="https://my-ineep.example.com"
export INEEPY_API_PATH="/api/v0"
export INEEPY_TOKEN="eyJhbGc..."
Then use the client without explicit arguments:
Warning
The ineepy.toml file takes precedence over environment variables. Make sure you don't have a ineepy.toml in your current working directory (CWD).