vc-utils 0.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.
- vc_utils-0.0.1/PKG-INFO +50 -0
- vc_utils-0.0.1/README.md +25 -0
- vc_utils-0.0.1/linkage/__init__.py +38 -0
- vc_utils-0.0.1/setup.cfg +4 -0
- vc_utils-0.0.1/setup.py +41 -0
- vc_utils-0.0.1/vc_utils.egg-info/PKG-INFO +50 -0
- vc_utils-0.0.1/vc_utils.egg-info/SOURCES.txt +8 -0
- vc_utils-0.0.1/vc_utils.egg-info/dependency_links.txt +1 -0
- vc_utils-0.0.1/vc_utils.egg-info/requires.txt +3 -0
- vc_utils-0.0.1/vc_utils.egg-info/top_level.txt +1 -0
vc_utils-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vc-utils
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Vulcan Coalition utililities
|
|
5
|
+
Home-page: https://github.com/vulcan-coalition/vulcan-utils
|
|
6
|
+
Author: Chatavut Viriyasuthee
|
|
7
|
+
Author-email: chatavut@lab.ai
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: shortuuid
|
|
14
|
+
Requires-Dist: dotenv
|
|
15
|
+
Requires-Dist: requests
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# vulcan-utils
|
|
27
|
+
|
|
28
|
+
Vulcan python utility
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
### Linkage APIs
|
|
33
|
+
|
|
34
|
+
- Linkage API for various services
|
|
35
|
+
|
|
36
|
+
### Collab APIs
|
|
37
|
+
|
|
38
|
+
- Collab API for various services
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install vulcan-utils
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from vulcan_utils import example_function
|
|
50
|
+
```
|
vc_utils-0.0.1/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# vulcan-utils
|
|
2
|
+
|
|
3
|
+
Vulcan python utility
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### Linkage APIs
|
|
8
|
+
|
|
9
|
+
- Linkage API for various services
|
|
10
|
+
|
|
11
|
+
### Collab APIs
|
|
12
|
+
|
|
13
|
+
- Collab API for various services
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install vulcan-utils
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from vulcan_utils import example_function
|
|
25
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import requests
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
import asyncio
|
|
5
|
+
import json
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
10
|
+
conf_file = os.path.join(dir_path, "../conf/default.json")
|
|
11
|
+
with open(conf_file, "r") as f:
|
|
12
|
+
config = json.load(f)
|
|
13
|
+
|
|
14
|
+
login_address = os.getenv("VU_LINKAGE_LOGIN_SERVICE", config.get("linkage", {}).get("VU_LINKAGE_LOGIN_SERVICE"))
|
|
15
|
+
user_address = os.getenv("VU_LINKAGE_USER_SERVICE", config.get("linkage", {}).get("VU_LINKAGE_USER_SERVICE"))
|
|
16
|
+
|
|
17
|
+
async def login(username: str, password: str):
|
|
18
|
+
# return (email, is_admin)
|
|
19
|
+
if login_address and user_address:
|
|
20
|
+
r = requests.post(login_address, data={'username': username, 'password': password})
|
|
21
|
+
if r.status_code < 400:
|
|
22
|
+
data = r.json()
|
|
23
|
+
headers = {
|
|
24
|
+
"Authorization": "Bearer " + data["access_token"]
|
|
25
|
+
}
|
|
26
|
+
response = requests.get(user_address, headers=headers)
|
|
27
|
+
try:
|
|
28
|
+
response.raise_for_status()
|
|
29
|
+
data = response.json()
|
|
30
|
+
data["email"] = data["email"].strip().lower()
|
|
31
|
+
if "performanceManager" in data["claims"]:
|
|
32
|
+
return {'email': data['email'], 'is_admin': True}
|
|
33
|
+
return {'email': data['email'], 'is_admin': False}
|
|
34
|
+
except requests.exceptions.HTTPError as exc:
|
|
35
|
+
logging.warning("Login failed", exc)
|
|
36
|
+
|
|
37
|
+
raise Exception("Login failed")
|
|
38
|
+
|
vc_utils-0.0.1/setup.cfg
ADDED
vc_utils-0.0.1/setup.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
try:
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
except ImportError:
|
|
4
|
+
from distutils.core import setup
|
|
5
|
+
|
|
6
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
7
|
+
long_description = fh.read()
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
import shutil
|
|
11
|
+
# copy files into package directory
|
|
12
|
+
|
|
13
|
+
if os.path.exists("build/lib/vc-utils/conf"):
|
|
14
|
+
shutil.rmtree("build/lib/vc-utils/conf")
|
|
15
|
+
shutil.copytree("conf", "build/lib/vc-utils/conf")
|
|
16
|
+
|
|
17
|
+
setup(
|
|
18
|
+
name="vc-utils",
|
|
19
|
+
version="0.0.1",
|
|
20
|
+
author="Chatavut Viriyasuthee",
|
|
21
|
+
author_email="chatavut@lab.ai",
|
|
22
|
+
description="Vulcan Coalition utililities",
|
|
23
|
+
long_description=long_description,
|
|
24
|
+
long_description_content_type="text/markdown",
|
|
25
|
+
url="https://github.com/vulcan-coalition/vulcan-utils",
|
|
26
|
+
packages=["linkage"],
|
|
27
|
+
package_data={
|
|
28
|
+
"": ["conf/*"]
|
|
29
|
+
},
|
|
30
|
+
classifiers=[
|
|
31
|
+
"Programming Language :: Python :: 3",
|
|
32
|
+
"License :: OSI Approved :: Apache Software License",
|
|
33
|
+
"Operating System :: OS Independent",
|
|
34
|
+
],
|
|
35
|
+
python_requires='>=3.9',
|
|
36
|
+
install_requires=[
|
|
37
|
+
"shortuuid",
|
|
38
|
+
"dotenv",
|
|
39
|
+
"requests"
|
|
40
|
+
]
|
|
41
|
+
)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vc-utils
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Vulcan Coalition utililities
|
|
5
|
+
Home-page: https://github.com/vulcan-coalition/vulcan-utils
|
|
6
|
+
Author: Chatavut Viriyasuthee
|
|
7
|
+
Author-email: chatavut@lab.ai
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: shortuuid
|
|
14
|
+
Requires-Dist: dotenv
|
|
15
|
+
Requires-Dist: requests
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# vulcan-utils
|
|
27
|
+
|
|
28
|
+
Vulcan python utility
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
### Linkage APIs
|
|
33
|
+
|
|
34
|
+
- Linkage API for various services
|
|
35
|
+
|
|
36
|
+
### Collab APIs
|
|
37
|
+
|
|
38
|
+
- Collab API for various services
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install vulcan-utils
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from vulcan_utils import example_function
|
|
50
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
linkage
|