vc-utils 2.0__tar.gz → 2.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.
- {vc_utils-2.0 → vc_utils-2.1}/PKG-INFO +4 -3
- {vc_utils-2.0 → vc_utils-2.1}/README.md +3 -2
- {vc_utils-2.0 → vc_utils-2.1}/linkage/session.py +19 -7
- {vc_utils-2.0 → vc_utils-2.1}/setup.py +1 -1
- {vc_utils-2.0 → vc_utils-2.1}/vc_utils.egg-info/PKG-INFO +4 -3
- {vc_utils-2.0 → vc_utils-2.1}/linkage/__init__.py +0 -0
- {vc_utils-2.0 → vc_utils-2.1}/linkage/key_generator.py +0 -0
- {vc_utils-2.0 → vc_utils-2.1}/setup.cfg +0 -0
- {vc_utils-2.0 → vc_utils-2.1}/vc_utils.egg-info/SOURCES.txt +0 -0
- {vc_utils-2.0 → vc_utils-2.1}/vc_utils.egg-info/dependency_links.txt +0 -0
- {vc_utils-2.0 → vc_utils-2.1}/vc_utils.egg-info/requires.txt +0 -0
- {vc_utils-2.0 → vc_utils-2.1}/vc_utils.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vc-utils
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1
|
|
4
4
|
Summary: Vulcan Coalition Python Utility Library
|
|
5
5
|
Home-page: https://github.com/vulcan-coalition/vulcan-utils
|
|
6
6
|
Author: Chatavut Viriyasuthee
|
|
@@ -35,7 +35,7 @@ Vulcan python utility
|
|
|
35
35
|
## Installation
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
pip install
|
|
38
|
+
pip install vc-utils
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## Usage
|
|
@@ -48,12 +48,13 @@ export LINKAGE_CLIENT_ID="test-client-id"
|
|
|
48
48
|
export LINKAGE_CLIENT_SECRET="test-client-secret"
|
|
49
49
|
|
|
50
50
|
export LINKAGE_M2M_HOST="https://application-linkage.vulcanproduct.com"
|
|
51
|
+
export LINKAGE_U2M_HOST="https://account-linkage.vulcanproduct.com"
|
|
51
52
|
```
|
|
52
53
|
|
|
53
54
|
Then you can import and use the Linkage API in your code:
|
|
54
55
|
|
|
55
56
|
```python
|
|
56
|
-
|
|
57
|
+
import linkage
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
## Test
|
|
@@ -11,7 +11,7 @@ Vulcan python utility
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
pip install
|
|
14
|
+
pip install vc-utils
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
@@ -24,12 +24,13 @@ export LINKAGE_CLIENT_ID="test-client-id"
|
|
|
24
24
|
export LINKAGE_CLIENT_SECRET="test-client-secret"
|
|
25
25
|
|
|
26
26
|
export LINKAGE_M2M_HOST="https://application-linkage.vulcanproduct.com"
|
|
27
|
+
export LINKAGE_U2M_HOST="https://account-linkage.vulcanproduct.com"
|
|
27
28
|
```
|
|
28
29
|
|
|
29
30
|
Then you can import and use the Linkage API in your code:
|
|
30
31
|
|
|
31
32
|
```python
|
|
32
|
-
|
|
33
|
+
import linkage
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
## Test
|
|
@@ -14,6 +14,7 @@ CLIENT_ID = None
|
|
|
14
14
|
CLIENT_SECRET = None
|
|
15
15
|
|
|
16
16
|
LINKAGE_M2M_HOST = None
|
|
17
|
+
LINKAGE_U2M_HOST = None
|
|
17
18
|
|
|
18
19
|
async def init():
|
|
19
20
|
LINKAGE_OPENID_CONF_PATH = os.getenv("LINKAGE_OPENID_CONF_PATH", None)
|
|
@@ -46,6 +47,11 @@ async def init():
|
|
|
46
47
|
if not LINKAGE_M2M_HOST:
|
|
47
48
|
raise Exception("LINKAGE_M2M_HOST environment variable must be set")
|
|
48
49
|
|
|
50
|
+
global LINKAGE_U2M_HOST
|
|
51
|
+
LINKAGE_U2M_HOST = os.getenv("LINKAGE_U2M_HOST", None)
|
|
52
|
+
if not LINKAGE_U2M_HOST:
|
|
53
|
+
raise Exception("LINKAGE_U2M_HOST environment variable must be set")
|
|
54
|
+
|
|
49
55
|
|
|
50
56
|
async def application_get_token():
|
|
51
57
|
# use separate session to avoid token refresh logic in Linkage_Application_Session
|
|
@@ -122,8 +128,7 @@ class Linkage_Application:
|
|
|
122
128
|
return await resp.json()
|
|
123
129
|
|
|
124
130
|
|
|
125
|
-
|
|
126
|
-
async def get_user_data(token):
|
|
131
|
+
async def get_user_data(token, spec_id=None):
|
|
127
132
|
if not token:
|
|
128
133
|
return None
|
|
129
134
|
|
|
@@ -131,11 +136,18 @@ async def get_user_data(token):
|
|
|
131
136
|
"Authorization": f"Bearer {token}"
|
|
132
137
|
}
|
|
133
138
|
async with aiohttp.ClientSession() as session:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
if spec_id is not None:
|
|
140
|
+
async with session.get(f"{LINKAGE_U2M_HOST}/data/{spec_id}", headers=headers) as resp:
|
|
141
|
+
if resp.status != 200:
|
|
142
|
+
error_data = await resp.json()
|
|
143
|
+
raise Exception(error_data)
|
|
144
|
+
return await resp.json()
|
|
145
|
+
else:
|
|
146
|
+
async with session.get(USERINFO_ENDPOINT, headers=headers) as resp:
|
|
147
|
+
if resp.status != 200:
|
|
148
|
+
error_data = await resp.json()
|
|
149
|
+
raise Exception(error_data)
|
|
150
|
+
return await resp.json()
|
|
139
151
|
|
|
140
152
|
|
|
141
153
|
def get_authn_req_url(scope, redirect_uri):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vc-utils
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1
|
|
4
4
|
Summary: Vulcan Coalition Python Utility Library
|
|
5
5
|
Home-page: https://github.com/vulcan-coalition/vulcan-utils
|
|
6
6
|
Author: Chatavut Viriyasuthee
|
|
@@ -35,7 +35,7 @@ Vulcan python utility
|
|
|
35
35
|
## Installation
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
pip install
|
|
38
|
+
pip install vc-utils
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## Usage
|
|
@@ -48,12 +48,13 @@ export LINKAGE_CLIENT_ID="test-client-id"
|
|
|
48
48
|
export LINKAGE_CLIENT_SECRET="test-client-secret"
|
|
49
49
|
|
|
50
50
|
export LINKAGE_M2M_HOST="https://application-linkage.vulcanproduct.com"
|
|
51
|
+
export LINKAGE_U2M_HOST="https://account-linkage.vulcanproduct.com"
|
|
51
52
|
```
|
|
52
53
|
|
|
53
54
|
Then you can import and use the Linkage API in your code:
|
|
54
55
|
|
|
55
56
|
```python
|
|
56
|
-
|
|
57
|
+
import linkage
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
## Test
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|