okdata-cli 4.0.0__tar.gz → 4.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {okdata-cli-4.0.0/okdata_cli.egg-info → okdata-cli-4.1.0}/PKG-INFO +1 -1
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/__main__.py +4 -3
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/datasets/questions.py +2 -45
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/datasets/wizards.py +0 -7
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/validators.py +0 -63
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_dataset_config.json +0 -1
- {okdata-cli-4.0.0 → okdata-cli-4.1.0/okdata_cli.egg-info}/PKG-INFO +1 -1
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata_cli.egg-info/requires.txt +1 -1
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/setup.py +2 -2
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/LICENSE +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/README.md +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/command.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/datasets/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/datasets/datasets.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/permissions.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/pubs/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/pubs/client.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/pubs/pubs.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/pubs/questions.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/pubs/wizards.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/status.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/teams/questions.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/teams/teams.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/teams/util.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/teams/wizards.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/commands/wizard.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_copy_file_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_copy_file_config_2.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_dataset_version_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_dataset_version_edition_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_dataset_version_edition_distributions_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_dataset_versions_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/my_permissions_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/permissions_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/pubs_audit_log_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/pubs_clients_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/pubs_multiple_client_keys_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/pubs_single_client_keys_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/status_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/status_history_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/team_members_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/teams_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/io.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/output.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata_cli.egg-info/SOURCES.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata_cli.egg-info/dependency_links.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata_cli.egg-info/entry_points.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata_cli.egg-info/namespace_packages.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata_cli.egg-info/top_level.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/pyproject.toml +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.1.0}/setup.cfg +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import sys
|
|
3
3
|
|
|
4
|
-
from keycloak.exceptions import KeycloakGetError
|
|
4
|
+
from keycloak.exceptions import KeycloakGetError, KeycloakPostError
|
|
5
5
|
from okdata.sdk.exceptions import ApiAuthenticateError
|
|
6
6
|
from requests.exceptions import RequestException
|
|
7
7
|
|
|
@@ -40,11 +40,12 @@ def main():
|
|
|
40
40
|
"An error occurred (ApiAuthenticateError): Invalid credentials",
|
|
41
41
|
{"error": 1, "message": "Invalid credentials"},
|
|
42
42
|
)
|
|
43
|
-
except KeycloakGetError as e:
|
|
43
|
+
except (KeycloakGetError, KeycloakPostError) as e:
|
|
44
44
|
error = json.loads(e.error_message)
|
|
45
|
+
error_type = e.__class__.__name__
|
|
45
46
|
instance.log.info(f"Keycloak reported: {e}")
|
|
46
47
|
instance.print(
|
|
47
|
-
f"An error occurred (
|
|
48
|
+
f"An error occurred ({error_type}): {error['error_description']}"
|
|
48
49
|
)
|
|
49
50
|
except (EOFError, KeyboardInterrupt):
|
|
50
51
|
instance.print("\nAbort.")
|
|
@@ -2,11 +2,7 @@ from questionary import Choice
|
|
|
2
2
|
|
|
3
3
|
from okdata.cli.commands.validators import (
|
|
4
4
|
KeywordValidator,
|
|
5
|
-
PhoneValidator,
|
|
6
5
|
SimpleEmailValidator,
|
|
7
|
-
SpatialResolutionValidator,
|
|
8
|
-
SpatialValidator,
|
|
9
|
-
StandardsValidator,
|
|
10
6
|
TitleValidator,
|
|
11
7
|
)
|
|
12
8
|
from okdata.cli.commands.wizard import filter_comma_separated, required_style
|
|
@@ -15,6 +11,7 @@ pipeline_choices = {
|
|
|
15
11
|
"file": [
|
|
16
12
|
Choice("Lagre dataen slik den er", "data-copy"),
|
|
17
13
|
Choice("Konverter fra CSV til Delta", "csv-to-delta"),
|
|
14
|
+
Choice("Konverter fra JSON til Delta", "json-to-delta"),
|
|
18
15
|
Choice("Konverter fra CSV til Parquet", "csv-to-parquet"),
|
|
19
16
|
Choice("Konverter fra Excel til CSV", "pipeline-excel-to-csv"),
|
|
20
17
|
Choice("Ingen prosessering (krever manuell konfigurasjon av pipeline)", False),
|
|
@@ -29,7 +26,7 @@ available_pipelines = [
|
|
|
29
26
|
]
|
|
30
27
|
|
|
31
28
|
|
|
32
|
-
def qs_create(
|
|
29
|
+
def qs_create():
|
|
33
30
|
return [
|
|
34
31
|
{
|
|
35
32
|
**required_style,
|
|
@@ -59,38 +56,6 @@ def qs_create(include_extra_metadata=True):
|
|
|
59
56
|
"validate": KeywordValidator,
|
|
60
57
|
"filter": filter_comma_separated,
|
|
61
58
|
},
|
|
62
|
-
{
|
|
63
|
-
**required_style,
|
|
64
|
-
"type": "confirm",
|
|
65
|
-
"name": "contains_geodata",
|
|
66
|
-
"message": "Inneholder datasettet geodata?",
|
|
67
|
-
"default": False,
|
|
68
|
-
"when": lambda x: include_extra_metadata,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"type": "text",
|
|
72
|
-
"name": "spatial",
|
|
73
|
-
"message": "Romlig avgrensning (komma-separert)",
|
|
74
|
-
"validate": SpatialValidator,
|
|
75
|
-
"filter": filter_comma_separated,
|
|
76
|
-
"when": lambda x: include_extra_metadata and x["contains_geodata"],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"type": "text",
|
|
80
|
-
"name": "spatialResolutionInMeters",
|
|
81
|
-
"message": "Romlig oppløsning (i meter)",
|
|
82
|
-
"validate": SpatialResolutionValidator,
|
|
83
|
-
"filter": lambda v: float(v.replace(",", ".")) if v else None,
|
|
84
|
-
"when": lambda x: include_extra_metadata and x["contains_geodata"],
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"type": "text",
|
|
88
|
-
"name": "conformsTo",
|
|
89
|
-
"message": "I samsvar med standarder (komma-separert)",
|
|
90
|
-
"validate": StandardsValidator,
|
|
91
|
-
"filter": filter_comma_separated,
|
|
92
|
-
"when": lambda x: include_extra_metadata,
|
|
93
|
-
},
|
|
94
59
|
{
|
|
95
60
|
**required_style,
|
|
96
61
|
"type": "select",
|
|
@@ -130,7 +95,6 @@ def qs_create(include_extra_metadata=True):
|
|
|
130
95
|
"http://creativecommons.org/publicdomain/zero/1.0/",
|
|
131
96
|
),
|
|
132
97
|
],
|
|
133
|
-
"when": lambda x: include_extra_metadata,
|
|
134
98
|
},
|
|
135
99
|
{"type": "text", "name": "name", "message": "Kontaktperson – navn"},
|
|
136
100
|
{
|
|
@@ -140,13 +104,6 @@ def qs_create(include_extra_metadata=True):
|
|
|
140
104
|
"message": "Kontaktperson – epost",
|
|
141
105
|
"validate": SimpleEmailValidator,
|
|
142
106
|
},
|
|
143
|
-
{
|
|
144
|
-
**required_style,
|
|
145
|
-
"type": "text",
|
|
146
|
-
"name": "phone",
|
|
147
|
-
"message": "Kontaktperson – telefon",
|
|
148
|
-
"validate": PhoneValidator,
|
|
149
|
-
},
|
|
150
107
|
{"type": "text", "name": "publisher", "message": "Utgiver"},
|
|
151
108
|
{
|
|
152
109
|
**required_style,
|
|
@@ -29,17 +29,10 @@ class DatasetCreateWizard:
|
|
|
29
29
|
"contactPoint": {
|
|
30
30
|
"name": choices["name"],
|
|
31
31
|
"email": choices["email"],
|
|
32
|
-
"phone": choices["phone"],
|
|
33
32
|
},
|
|
34
33
|
"publisher": choices["publisher"],
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
if choices.get("spatial"):
|
|
38
|
-
config["spatial"] = choices["spatial"]
|
|
39
|
-
if choices.get("spatialResolutionInMeters"):
|
|
40
|
-
config["spatialResolutionInMeters"] = choices["spatialResolutionInMeters"]
|
|
41
|
-
if choices.get("conformsTo"):
|
|
42
|
-
config["conformsTo"] = choices["conformsTo"]
|
|
43
36
|
if choices.get("license"):
|
|
44
37
|
config["license"] = choices["license"]
|
|
45
38
|
|
|
@@ -33,15 +33,6 @@ class SimpleEmailValidator(Validator):
|
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
class PhoneValidator(Validator):
|
|
37
|
-
def validate(self, document):
|
|
38
|
-
if not re.match(r"^[0-9]+$", document.text):
|
|
39
|
-
raise ValidationError(
|
|
40
|
-
message="Please enter a valid phone - all numbers and no space, example: 232334455",
|
|
41
|
-
cursor_position=len(document.text),
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
|
|
45
36
|
class TitleValidator(Validator):
|
|
46
37
|
def validate(self, document):
|
|
47
38
|
if len(document.text) < 5:
|
|
@@ -70,60 +61,6 @@ class KeywordValidator(Validator):
|
|
|
70
61
|
)
|
|
71
62
|
|
|
72
63
|
|
|
73
|
-
class StandardsValidator(Validator):
|
|
74
|
-
def validate(self, document):
|
|
75
|
-
standards = csv.reader(
|
|
76
|
-
[document.text], delimiter=",", escapechar="\\", skipinitialspace=True
|
|
77
|
-
)
|
|
78
|
-
standards = [x.strip() for x in next(standards)]
|
|
79
|
-
for standard in standards:
|
|
80
|
-
if len(standard) < 3:
|
|
81
|
-
raise ValidationError(
|
|
82
|
-
message="Each standard reference must be at least 3 characters",
|
|
83
|
-
cursor_position=len(document.text),
|
|
84
|
-
)
|
|
85
|
-
if len(standards) != len(set(standards)):
|
|
86
|
-
raise ValidationError(
|
|
87
|
-
message="Each standard reference must be unique",
|
|
88
|
-
cursor_position=len(document.text),
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class SpatialValidator(Validator):
|
|
93
|
-
def validate(self, document):
|
|
94
|
-
locations = csv.reader(
|
|
95
|
-
[document.text], delimiter=",", escapechar="\\", skipinitialspace=True
|
|
96
|
-
)
|
|
97
|
-
locations = [x.strip() for x in next(locations)]
|
|
98
|
-
for location in locations:
|
|
99
|
-
if len(location) < 1:
|
|
100
|
-
raise ValidationError(
|
|
101
|
-
message="Each location must be at least 1 character",
|
|
102
|
-
cursor_position=len(document.text),
|
|
103
|
-
)
|
|
104
|
-
if len(locations) != len(set(locations)):
|
|
105
|
-
raise ValidationError(
|
|
106
|
-
message="Each location must be unique",
|
|
107
|
-
cursor_position=len(document.text),
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class SpatialResolutionValidator(Validator):
|
|
112
|
-
def validate(self, document):
|
|
113
|
-
if not document.text:
|
|
114
|
-
return None
|
|
115
|
-
try:
|
|
116
|
-
number = float(document.text.replace(",", "."))
|
|
117
|
-
if number <= 0:
|
|
118
|
-
raise ValueError
|
|
119
|
-
except ValueError:
|
|
120
|
-
raise ValidationError(
|
|
121
|
-
message="Please enter a positive (decimal) number",
|
|
122
|
-
cursor_position=len(document.text),
|
|
123
|
-
)
|
|
124
|
-
return None
|
|
125
|
-
|
|
126
|
-
|
|
127
64
|
class IntegrationValidator(Validator):
|
|
128
65
|
def validate(self, document):
|
|
129
66
|
if len(document.text) > 30:
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="okdata-cli",
|
|
8
|
-
version="4.
|
|
8
|
+
version="4.1.0",
|
|
9
9
|
author="Oslo Origo",
|
|
10
10
|
author_email="dataplattform@oslo.kommune.no",
|
|
11
11
|
description="CLI for services provided by Oslo Origo",
|
|
@@ -25,7 +25,7 @@ setuptools.setup(
|
|
|
25
25
|
install_requires=[
|
|
26
26
|
"PrettyTable",
|
|
27
27
|
"docopt",
|
|
28
|
-
"okdata-sdk>=3.1,<4",
|
|
28
|
+
"okdata-sdk>=3.1.1,<4",
|
|
29
29
|
"questionary>=1.10.0,<2.0.0",
|
|
30
30
|
"requests",
|
|
31
31
|
],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_copy_file_config.json
RENAMED
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/datasets_copy_file_config_2.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/my_permissions_config.json
RENAMED
|
File without changes
|
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/pubs_audit_log_config.json
RENAMED
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/pubs_clients_config.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/status_history_config.json
RENAMED
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.1.0}/okdata/cli/data/output-format/team_members_config.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|