dotstat_io 0.2.7__tar.gz → 1.0.1__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.
Potentially problematic release.
This version of dotstat_io might be problematic. Click here for more details.
- {dotstat_io-0.2.7 → dotstat_io-1.0.1}/PKG-INFO +49 -33
- {dotstat_io-0.2.7 → dotstat_io-1.0.1}/README.md +46 -32
- dotstat_io-1.0.1/dotstat_io/authentication.py +354 -0
- dotstat_io-1.0.1/dotstat_io/client.py +402 -0
- {dotstat_io-0.2.7 → dotstat_io-1.0.1}/pyproject.toml +24 -23
- dotstat_io-0.2.7/dotstat_io/authentication.py +0 -335
- dotstat_io-0.2.7/dotstat_io/download_upload.py +0 -376
- {dotstat_io-0.2.7 → dotstat_io-1.0.1}/dotstat_io/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dotstat_io
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Utility to download or upload data from/to .Stat Suite using ADFS authentication to connect to it
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Gyorgy Gyomai
|
|
@@ -11,13 +11,15 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
15
|
Requires-Dist: chardet (>=5.1.0,<6.0.0)
|
|
15
16
|
Requires-Dist: msal (>=1.22.0,<2.0.0)
|
|
16
17
|
Requires-Dist: requests (>=2.29.0,<3.0.0)
|
|
17
18
|
Requires-Dist: requests-kerberos (>=0.14.0,<0.15.0)
|
|
19
|
+
Requires-Dist: setuptools (>=75.6.0,<76.0.0)
|
|
18
20
|
Description-Content-Type: text/markdown
|
|
19
21
|
|
|
20
|
-
### DotStat_IO:
|
|
22
|
+
### DotStat_IO package:
|
|
21
23
|
A generic python package which could be integrated with other end-user applications and Gitlab runner to perform basic io with .Stat Suite.
|
|
22
24
|
Its role is to mask the complexities of authentication to connect to .Stat Suite.
|
|
23
25
|
The user needs to provide a set of parameters and the package exposes a couple of methods which will download or upload data from/to .Stat Suite.
|
|
@@ -25,19 +27,19 @@ The user needs to provide a set of parameters and the package exposes a couple o
|
|
|
25
27
|
### This package contains three modules:
|
|
26
28
|
- ADFSAuthentication module
|
|
27
29
|
- KeycloakAuthentication module
|
|
28
|
-
-
|
|
30
|
+
- Client module
|
|
29
31
|
|
|
30
32
|
### In ADFSAuthentication module, four methods are available:
|
|
31
33
|
#### 1. To initialise the module for interactive use:
|
|
32
34
|
```python
|
|
33
35
|
from dotstat_io.authentication import AdfsAuthentication
|
|
34
|
-
|
|
36
|
+
interactive_obj = AdfsAuthentication.interactive(
|
|
35
37
|
client_id=client_id,
|
|
36
38
|
sdmx_resource_id=sdmx_resource_id,
|
|
37
39
|
scopes=scopes,
|
|
38
40
|
authority_url=authority_url,
|
|
39
|
-
redirect_port=redirect_port)
|
|
40
|
-
|
|
41
|
+
redirect_port=redirect_port)
|
|
42
|
+
|
|
41
43
|
```
|
|
42
44
|
* `client_id:` The Application (client) ID that the ADFS assigned to your app
|
|
43
45
|
* `sdmx_resource_id:` The ID of the application to be accessed such as .Stat Suite
|
|
@@ -48,13 +50,13 @@ with AdfsAuthentication.interactive(
|
|
|
48
50
|
#### 2. To initialise the module for non-interactive use using a secret:
|
|
49
51
|
```python
|
|
50
52
|
from dotstat_io.authentication import AdfsAuthentication
|
|
51
|
-
|
|
53
|
+
noninteractive_with_secret_obj = AdfsAuthentication.noninteractive_with_secret(
|
|
52
54
|
client_id=client_id,
|
|
53
55
|
sdmx_resource_id=sdmx_resource_id,
|
|
54
56
|
scopes=scopes,
|
|
55
57
|
authority_url=authority_url,
|
|
56
|
-
client_secret=client_secret)
|
|
57
|
-
|
|
58
|
+
client_secret=client_secret)
|
|
59
|
+
|
|
58
60
|
```
|
|
59
61
|
* `client_id:` The Application (client) ID that the ADFS assigned to your app
|
|
60
62
|
* `sdmx_resource_id:` The ID of the application to be accessed such as .Stat Suite
|
|
@@ -65,11 +67,11 @@ with AdfsAuthentication.nointeractive_with_secret(
|
|
|
65
67
|
#### 3. To initialise the module for non-interactive use using windows client authentication:
|
|
66
68
|
```python
|
|
67
69
|
from dotstat_io.authentication import AdfsAuthentication
|
|
68
|
-
|
|
70
|
+
noninteractive_with_adfs_obj = AdfsAuthentication.noninteractive_with_adfs(
|
|
69
71
|
client_id=client_id,
|
|
70
72
|
sdmx_resource_id=sdmx_resource_id,
|
|
71
|
-
token_url=token_url)
|
|
72
|
-
|
|
73
|
+
token_url=token_url)
|
|
74
|
+
|
|
73
75
|
```
|
|
74
76
|
* `client_id:` The Application (client) ID that the ADFS assigned to your app
|
|
75
77
|
* `sdmx_resource_id:` The ID of the application to be accessed such as .Stat Suite
|
|
@@ -84,12 +86,12 @@ access_token = [Authentication Object Name].get_token()
|
|
|
84
86
|
#### 1. To initialise the module for Keycloak authentication:
|
|
85
87
|
```python
|
|
86
88
|
from dotstat_io.authentication import KeycloakAuthentication
|
|
87
|
-
|
|
89
|
+
noninteractive_with_keycloak_obj = KeycloakAuthentication.noninteractive_with_secret(
|
|
88
90
|
user=user,
|
|
89
91
|
password=password,
|
|
90
92
|
token_url=token_url,
|
|
91
|
-
proxy=proxy)
|
|
92
|
-
|
|
93
|
+
proxy=proxy)
|
|
94
|
+
|
|
93
95
|
```
|
|
94
96
|
* `user:` User name for .Stat Suite authentication
|
|
95
97
|
* `password:` User name's password
|
|
@@ -101,33 +103,47 @@ with KeycloakAuthentication.nointeractive_with_secret(
|
|
|
101
103
|
access_token = [Authentication Object Name].get_token()
|
|
102
104
|
```
|
|
103
105
|
|
|
104
|
-
### In
|
|
105
|
-
#### 1. To
|
|
106
|
+
### In Client module, six methods are available:
|
|
107
|
+
#### 1. To initialise the module using an Authentication object type AdfsAuthentication or KeycloakAuthentication:
|
|
108
|
+
```python
|
|
109
|
+
from dotstat_io.client import Client
|
|
110
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
111
|
+
```
|
|
112
|
+
* `Authentication_obj:` An initialized authentication object type AdfsAuthentication or KeycloakAuthentication
|
|
113
|
+
|
|
114
|
+
#### 2. To initialise the module using an access token:
|
|
115
|
+
```python
|
|
116
|
+
from dotstat_io.client import Client
|
|
117
|
+
client_obj = Client.init_with_access_token(access_token)
|
|
118
|
+
```
|
|
119
|
+
* `access_token:` An access token to make requests on .Stat Suite services (nsiws) using the authorisation service and underlying permission rules
|
|
120
|
+
|
|
121
|
+
#### 3. To download a file from .Stat Suite:
|
|
106
122
|
```python
|
|
107
|
-
from dotstat_io.
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
from dotstat_io.client import Client
|
|
124
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
125
|
+
returned_result = client_obj.download_data_file(
|
|
110
126
|
dotstat_url, content_format, Path(file_path))
|
|
111
127
|
```
|
|
112
128
|
* `dotstat_url:` URL of data to be downloaded from .Stat Suite
|
|
113
129
|
* `content_format:` Format of the downloaded content
|
|
114
130
|
* `file_path:` The full path where the file will downloaded
|
|
115
131
|
|
|
116
|
-
####
|
|
132
|
+
#### 4. To download streamed content from .Stat Suite:
|
|
117
133
|
```python
|
|
118
|
-
from dotstat_io.
|
|
119
|
-
|
|
120
|
-
|
|
134
|
+
from dotstat_io.client import Client
|
|
135
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
136
|
+
returned_result = client_obj.download_data_stream(
|
|
121
137
|
dotstat_url, content_format)
|
|
122
138
|
```
|
|
123
139
|
* `dotstat_url:` URL of data to be downloaded from .Stat Suite
|
|
124
140
|
* `content_format:` Format of the downloaded content
|
|
125
141
|
|
|
126
|
-
####
|
|
142
|
+
#### 5. To upload a data file to .Stat Suite:
|
|
127
143
|
```python
|
|
128
|
-
from dotstat_io.
|
|
129
|
-
|
|
130
|
-
|
|
144
|
+
from dotstat_io.client import Client
|
|
145
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
146
|
+
returned_result = client_obj.upload_data_file(
|
|
131
147
|
transfer_url, Path(file_path), space, validationType, use_filepath)
|
|
132
148
|
```
|
|
133
149
|
* `transfer_url:` URL of the transfer service
|
|
@@ -136,15 +152,15 @@ with Download_upload(adfsAuthentication_obj, access_token) as Download_upload_ob
|
|
|
136
152
|
* `validationType:` The type of validation to use during upload. Possible values: Basic Validation (0), Advanced Validation (1)
|
|
137
153
|
* `use_filepath:` Use a file path of a shared folder accessible by the .Stat Suite data upload engine (for unlimited file sizes)
|
|
138
154
|
|
|
139
|
-
####
|
|
155
|
+
#### 6. To upload a structure to .Stat Suite:
|
|
140
156
|
```python
|
|
141
|
-
from dotstat_io.
|
|
142
|
-
|
|
143
|
-
|
|
157
|
+
from dotstat_io.client import Client
|
|
158
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
159
|
+
returned_result = client_obj.upload_structure(
|
|
144
160
|
transfer_url, Path(file_path))
|
|
145
161
|
```
|
|
146
162
|
* `transfer_url:` URL of the transfer service
|
|
147
163
|
* `file_path:` The full path of the SDMX-ML file, which will be uploaded to .Stat Suite
|
|
148
164
|
|
|
149
|
-
### For more information about how to use this package, all test cases can be accessed from this [`link`](https://gitlab.algobank.oecd.org/
|
|
165
|
+
### For more information about how to use this package, all test cases can be accessed from this [`link`](https://gitlab.algobank.oecd.org/SD_ENGINEERING/dotstat_io/dotstat_io-package/-/blob/main/tests/test_cases.py)
|
|
150
166
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
### DotStat_IO:
|
|
1
|
+
### DotStat_IO package:
|
|
2
2
|
A generic python package which could be integrated with other end-user applications and Gitlab runner to perform basic io with .Stat Suite.
|
|
3
3
|
Its role is to mask the complexities of authentication to connect to .Stat Suite.
|
|
4
4
|
The user needs to provide a set of parameters and the package exposes a couple of methods which will download or upload data from/to .Stat Suite.
|
|
@@ -6,19 +6,19 @@ The user needs to provide a set of parameters and the package exposes a couple o
|
|
|
6
6
|
### This package contains three modules:
|
|
7
7
|
- ADFSAuthentication module
|
|
8
8
|
- KeycloakAuthentication module
|
|
9
|
-
-
|
|
9
|
+
- Client module
|
|
10
10
|
|
|
11
11
|
### In ADFSAuthentication module, four methods are available:
|
|
12
12
|
#### 1. To initialise the module for interactive use:
|
|
13
13
|
```python
|
|
14
14
|
from dotstat_io.authentication import AdfsAuthentication
|
|
15
|
-
|
|
15
|
+
interactive_obj = AdfsAuthentication.interactive(
|
|
16
16
|
client_id=client_id,
|
|
17
17
|
sdmx_resource_id=sdmx_resource_id,
|
|
18
18
|
scopes=scopes,
|
|
19
19
|
authority_url=authority_url,
|
|
20
|
-
redirect_port=redirect_port)
|
|
21
|
-
|
|
20
|
+
redirect_port=redirect_port)
|
|
21
|
+
|
|
22
22
|
```
|
|
23
23
|
* `client_id:` The Application (client) ID that the ADFS assigned to your app
|
|
24
24
|
* `sdmx_resource_id:` The ID of the application to be accessed such as .Stat Suite
|
|
@@ -29,13 +29,13 @@ with AdfsAuthentication.interactive(
|
|
|
29
29
|
#### 2. To initialise the module for non-interactive use using a secret:
|
|
30
30
|
```python
|
|
31
31
|
from dotstat_io.authentication import AdfsAuthentication
|
|
32
|
-
|
|
32
|
+
noninteractive_with_secret_obj = AdfsAuthentication.noninteractive_with_secret(
|
|
33
33
|
client_id=client_id,
|
|
34
34
|
sdmx_resource_id=sdmx_resource_id,
|
|
35
35
|
scopes=scopes,
|
|
36
36
|
authority_url=authority_url,
|
|
37
|
-
client_secret=client_secret)
|
|
38
|
-
|
|
37
|
+
client_secret=client_secret)
|
|
38
|
+
|
|
39
39
|
```
|
|
40
40
|
* `client_id:` The Application (client) ID that the ADFS assigned to your app
|
|
41
41
|
* `sdmx_resource_id:` The ID of the application to be accessed such as .Stat Suite
|
|
@@ -46,11 +46,11 @@ with AdfsAuthentication.nointeractive_with_secret(
|
|
|
46
46
|
#### 3. To initialise the module for non-interactive use using windows client authentication:
|
|
47
47
|
```python
|
|
48
48
|
from dotstat_io.authentication import AdfsAuthentication
|
|
49
|
-
|
|
49
|
+
noninteractive_with_adfs_obj = AdfsAuthentication.noninteractive_with_adfs(
|
|
50
50
|
client_id=client_id,
|
|
51
51
|
sdmx_resource_id=sdmx_resource_id,
|
|
52
|
-
token_url=token_url)
|
|
53
|
-
|
|
52
|
+
token_url=token_url)
|
|
53
|
+
|
|
54
54
|
```
|
|
55
55
|
* `client_id:` The Application (client) ID that the ADFS assigned to your app
|
|
56
56
|
* `sdmx_resource_id:` The ID of the application to be accessed such as .Stat Suite
|
|
@@ -65,12 +65,12 @@ access_token = [Authentication Object Name].get_token()
|
|
|
65
65
|
#### 1. To initialise the module for Keycloak authentication:
|
|
66
66
|
```python
|
|
67
67
|
from dotstat_io.authentication import KeycloakAuthentication
|
|
68
|
-
|
|
68
|
+
noninteractive_with_keycloak_obj = KeycloakAuthentication.noninteractive_with_secret(
|
|
69
69
|
user=user,
|
|
70
70
|
password=password,
|
|
71
71
|
token_url=token_url,
|
|
72
|
-
proxy=proxy)
|
|
73
|
-
|
|
72
|
+
proxy=proxy)
|
|
73
|
+
|
|
74
74
|
```
|
|
75
75
|
* `user:` User name for .Stat Suite authentication
|
|
76
76
|
* `password:` User name's password
|
|
@@ -82,33 +82,47 @@ with KeycloakAuthentication.nointeractive_with_secret(
|
|
|
82
82
|
access_token = [Authentication Object Name].get_token()
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
### In
|
|
86
|
-
#### 1. To
|
|
85
|
+
### In Client module, six methods are available:
|
|
86
|
+
#### 1. To initialise the module using an Authentication object type AdfsAuthentication or KeycloakAuthentication:
|
|
87
|
+
```python
|
|
88
|
+
from dotstat_io.client import Client
|
|
89
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
90
|
+
```
|
|
91
|
+
* `Authentication_obj:` An initialized authentication object type AdfsAuthentication or KeycloakAuthentication
|
|
92
|
+
|
|
93
|
+
#### 2. To initialise the module using an access token:
|
|
94
|
+
```python
|
|
95
|
+
from dotstat_io.client import Client
|
|
96
|
+
client_obj = Client.init_with_access_token(access_token)
|
|
97
|
+
```
|
|
98
|
+
* `access_token:` An access token to make requests on .Stat Suite services (nsiws) using the authorisation service and underlying permission rules
|
|
99
|
+
|
|
100
|
+
#### 3. To download a file from .Stat Suite:
|
|
87
101
|
```python
|
|
88
|
-
from dotstat_io.
|
|
89
|
-
|
|
90
|
-
|
|
102
|
+
from dotstat_io.client import Client
|
|
103
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
104
|
+
returned_result = client_obj.download_data_file(
|
|
91
105
|
dotstat_url, content_format, Path(file_path))
|
|
92
106
|
```
|
|
93
107
|
* `dotstat_url:` URL of data to be downloaded from .Stat Suite
|
|
94
108
|
* `content_format:` Format of the downloaded content
|
|
95
109
|
* `file_path:` The full path where the file will downloaded
|
|
96
110
|
|
|
97
|
-
####
|
|
111
|
+
#### 4. To download streamed content from .Stat Suite:
|
|
98
112
|
```python
|
|
99
|
-
from dotstat_io.
|
|
100
|
-
|
|
101
|
-
|
|
113
|
+
from dotstat_io.client import Client
|
|
114
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
115
|
+
returned_result = client_obj.download_data_stream(
|
|
102
116
|
dotstat_url, content_format)
|
|
103
117
|
```
|
|
104
118
|
* `dotstat_url:` URL of data to be downloaded from .Stat Suite
|
|
105
119
|
* `content_format:` Format of the downloaded content
|
|
106
120
|
|
|
107
|
-
####
|
|
121
|
+
#### 5. To upload a data file to .Stat Suite:
|
|
108
122
|
```python
|
|
109
|
-
from dotstat_io.
|
|
110
|
-
|
|
111
|
-
|
|
123
|
+
from dotstat_io.client import Client
|
|
124
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
125
|
+
returned_result = client_obj.upload_data_file(
|
|
112
126
|
transfer_url, Path(file_path), space, validationType, use_filepath)
|
|
113
127
|
```
|
|
114
128
|
* `transfer_url:` URL of the transfer service
|
|
@@ -117,14 +131,14 @@ with Download_upload(adfsAuthentication_obj, access_token) as Download_upload_ob
|
|
|
117
131
|
* `validationType:` The type of validation to use during upload. Possible values: Basic Validation (0), Advanced Validation (1)
|
|
118
132
|
* `use_filepath:` Use a file path of a shared folder accessible by the .Stat Suite data upload engine (for unlimited file sizes)
|
|
119
133
|
|
|
120
|
-
####
|
|
134
|
+
#### 6. To upload a structure to .Stat Suite:
|
|
121
135
|
```python
|
|
122
|
-
from dotstat_io.
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
from dotstat_io.client import Client
|
|
137
|
+
client_obj = Client.init_with_authentication_obj(Authentication_obj)
|
|
138
|
+
returned_result = client_obj.upload_structure(
|
|
125
139
|
transfer_url, Path(file_path))
|
|
126
140
|
```
|
|
127
141
|
* `transfer_url:` URL of the transfer service
|
|
128
142
|
* `file_path:` The full path of the SDMX-ML file, which will be uploaded to .Stat Suite
|
|
129
143
|
|
|
130
|
-
### For more information about how to use this package, all test cases can be accessed from this [`link`](https://gitlab.algobank.oecd.org/
|
|
144
|
+
### For more information about how to use this package, all test cases can be accessed from this [`link`](https://gitlab.algobank.oecd.org/SD_ENGINEERING/dotstat_io/dotstat_io-package/-/blob/main/tests/test_cases.py)
|