brynq-sdk-vplan 1.2.4__tar.gz → 2.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.
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/PKG-INFO +1 -1
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/__init__.py +6 -5
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/leave.py +8 -9
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan.egg-info/PKG-INFO +1 -1
- brynq_sdk_vplan-2.0.1/brynq_sdk_vplan.egg-info/requires.txt +2 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/setup.py +2 -2
- brynq_sdk_vplan-1.2.4/brynq_sdk_vplan.egg-info/requires.txt +0 -2
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/activity.py +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/get_data.py +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/item.py +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/order.py +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/project.py +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/resource.py +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/time_tracking.py +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan/user.py +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan.egg-info/not-zip-safe +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan.egg-info/top_level.txt +0 -0
- {brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/setup.cfg +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from brynq_sdk_brynq import BrynQ
|
|
2
|
-
from typing import List, Union
|
|
2
|
+
from typing import List, Union, Literal, Optional
|
|
3
3
|
from .get_data import GetData
|
|
4
4
|
from .activity import Activity
|
|
5
5
|
from .item import Item
|
|
@@ -12,13 +12,13 @@ from .leave import Leave
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class VPlan(BrynQ):
|
|
15
|
-
def __init__(self,
|
|
15
|
+
def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug: bool = False):
|
|
16
16
|
"""
|
|
17
17
|
A class to fetch data from the vPlan API. See https://developer.vplan.com/documentation/#tag/General/ for more information
|
|
18
18
|
"""
|
|
19
19
|
super().__init__()
|
|
20
20
|
self.timeout = 3600
|
|
21
|
-
self.headers = self._get_credentials(
|
|
21
|
+
self.headers = self._get_credentials(system_type)
|
|
22
22
|
self.post_headers = {**self.headers, 'Content-Type': 'application/json'}
|
|
23
23
|
self.base_url = 'https://api.vplan.com/v1/'
|
|
24
24
|
self.get = GetData(self)
|
|
@@ -31,13 +31,14 @@ class VPlan(BrynQ):
|
|
|
31
31
|
self.user = User(self)
|
|
32
32
|
self.leave = Leave(self)
|
|
33
33
|
|
|
34
|
-
def _get_credentials(self,
|
|
34
|
+
def _get_credentials(self, system_type) -> dict:
|
|
35
35
|
"""
|
|
36
36
|
Retrieve API key and env from the system credentials.
|
|
37
37
|
Args: label (Union[str, List]): The label or list of labels to get the credentials.
|
|
38
38
|
Returns: str: The authorization headers
|
|
39
39
|
"""
|
|
40
|
-
credentials = self.
|
|
40
|
+
credentials = self.interfaces.credentials.get(system="vplan", system_type=system_type)
|
|
41
|
+
credentials = credentials.get('data')
|
|
41
42
|
headers = {
|
|
42
43
|
'X-Api-Key': credentials['X-Api-Key'],
|
|
43
44
|
'X-Api-Env': credentials['X-Api-Env']
|
|
@@ -16,17 +16,16 @@ class Leave:
|
|
|
16
16
|
|
|
17
17
|
def get_leave(self, resource_id: str) -> requests.Response:
|
|
18
18
|
"""
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
This method constructs a request URL based on the endpoint and sends a GET request
|
|
22
|
-
to the vPlan API.
|
|
19
|
+
Get leave data for a specific resource.
|
|
23
20
|
|
|
24
|
-
Args:
|
|
21
|
+
Args:
|
|
22
|
+
resource_id (str): The id of the resource to get the leave from.
|
|
25
23
|
|
|
26
|
-
Returns:
|
|
24
|
+
Returns:
|
|
25
|
+
requests.Response: The response from the vPlan API containing schedule deviations.
|
|
27
26
|
"""
|
|
28
|
-
url = f"{self.vplan.base_url}resource/{resource_id}
|
|
29
|
-
response = requests.request('GET', url, headers=self.vplan.headers
|
|
27
|
+
url = f"{self.vplan.base_url}resource/{resource_id}?with=schedule_deviations"
|
|
28
|
+
response = requests.request('GET', url, headers=self.vplan.headers)
|
|
30
29
|
return response
|
|
31
30
|
|
|
32
31
|
def post_leave(self, resource_id: str, data: dict) -> requests.Response:
|
|
@@ -107,4 +106,4 @@ class Leave:
|
|
|
107
106
|
|
|
108
107
|
for field in required_fields:
|
|
109
108
|
if field not in data:
|
|
110
|
-
raise ValueError('Field {field} is required. Required fields are: {required_fields}'.format(field=field, required_fields=tuple(required_fields)))
|
|
109
|
+
raise ValueError('Field {field} is required. Required fields are: {required_fields}'.format(field=field, required_fields=tuple(required_fields)))
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='brynq_sdk_vplan',
|
|
5
|
-
version='
|
|
5
|
+
version='2.0.1',
|
|
6
6
|
description='vPlan wrapper from BrynQ',
|
|
7
7
|
long_description='vPlan wrapper from BrynQ',
|
|
8
8
|
author='BrynQ',
|
|
@@ -10,7 +10,7 @@ setup(
|
|
|
10
10
|
packages=find_namespace_packages(include=['brynq_sdk*']),
|
|
11
11
|
license='BrynQ License',
|
|
12
12
|
install_requires=[
|
|
13
|
-
'brynq-sdk-brynq>=
|
|
13
|
+
'brynq-sdk-brynq>=4,<5',
|
|
14
14
|
'pandas>=2,<3'
|
|
15
15
|
],
|
|
16
16
|
zip_safe=False,
|
|
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
|
{brynq_sdk_vplan-1.2.4 → brynq_sdk_vplan-2.0.1}/brynq_sdk_vplan.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|