Utils
ConfigType
¶
Bases: Path
Click type allowing CLI functions to get a config object from a path.
Source code in dataimporter/cli/utils.py
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 | |
convert(value, param, ctx)
¶
Convert the given value to a Config object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
the value passed from Click, hopefully this is a path of some kind |
required |
param
|
Optional[Parameter]
|
the parameter that is using this type to convert its value. May be None. |
required |
ctx
|
Optional[Context]
|
the current context that arrived at this value. May be None. |
required |
Returns:
| Type | Description |
|---|---|
Config
|
a config object |
Source code in dataimporter/cli/utils.py
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 | |
get_api_key(db_dsn, admin_user)
¶
Get the API key for the admin user and return it, or None if we can't get the key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_dsn
|
str
|
the database datasource name to connect to |
required |
admin_user
|
str
|
the name of the admin user to get the API key for |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
the API key |
Source code in dataimporter/cli/utils.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |