brynq-sdk-sharepoint 2.0.2__tar.gz → 3.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.
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/PKG-INFO +1 -1
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint/sharepoint.py +16 -8
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint.egg-info/PKG-INFO +1 -1
- brynq_sdk_sharepoint-3.1.0/brynq_sdk_sharepoint.egg-info/requires.txt +2 -0
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/setup.py +3 -3
- brynq_sdk_sharepoint-2.0.2/brynq_sdk_sharepoint.egg-info/requires.txt +0 -2
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint/__init__.py +0 -0
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint.egg-info/not-zip-safe +0 -0
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint.egg-info/top_level.txt +0 -0
- {brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/setup.cfg +0 -0
{brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint/sharepoint.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from brynq_sdk_brynq import BrynQ
|
|
2
2
|
import os
|
|
3
|
-
from typing import List, Union
|
|
3
|
+
from typing import List, Union, Literal, Optional
|
|
4
4
|
import requests
|
|
5
5
|
import json
|
|
6
6
|
from io import BytesIO
|
|
@@ -8,22 +8,25 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Sharepoint(BrynQ):
|
|
11
|
-
def __init__(self,
|
|
11
|
+
def __init__(self, system_type: Optional[Literal['source', 'target']] = None, site: str = None, site_id: str = None, json_subset: int = None, site_name: str = None, debug: bool = False, deviating_data_interface_id: int = None):
|
|
12
12
|
"""
|
|
13
13
|
:param label: label of the sharepoint system in BrynQ
|
|
14
14
|
:param site: base url of the sharepoint site
|
|
15
15
|
:param site_id: site id of the sharepoint site
|
|
16
16
|
:param json_subset: fill in the part of the json that needs to be accessed to get the wanted drive id, accompanying the drive you are looking for
|
|
17
17
|
:param debug: set to True to enable debug logging
|
|
18
|
+
:param deviating_data_interface_id: Sometimes you need to get credentials from another data interface. This is the data interface id of the data interface you want to get the credentials from.
|
|
18
19
|
"""
|
|
19
20
|
super().__init__()
|
|
20
|
-
|
|
21
|
+
self.system_type = system_type
|
|
22
|
+
self.data_interface_id = deviating_data_interface_id if deviating_data_interface_id is not None else self.data_interface_id
|
|
23
|
+
credentials = self.interfaces.credentials.get(system="sharepoint", system_type=system_type)
|
|
24
|
+
credentials = credentials.get('data')
|
|
21
25
|
self.debug = debug
|
|
22
26
|
self.timeout = 3600
|
|
23
27
|
if self.debug:
|
|
24
28
|
print(f"credentials: {credentials}")
|
|
25
|
-
self.access_token = credentials['
|
|
26
|
-
self.brynq_system_id = credentials['id']
|
|
29
|
+
self.access_token = credentials['access_token']
|
|
27
30
|
if site_name is not None:
|
|
28
31
|
self.json_subset = 0 if json_subset is None else json_subset
|
|
29
32
|
self.site_id = self.get_site_id(site_name=site_name)
|
|
@@ -33,11 +36,16 @@ class Sharepoint(BrynQ):
|
|
|
33
36
|
else:
|
|
34
37
|
raise KeyError('Either site_name or site_id, site and json_subset must be provided')
|
|
35
38
|
if self.debug:
|
|
36
|
-
print(f"site_id: {self.site_id}, json_subset: {self.json_subset}, credentials: {credentials}
|
|
39
|
+
print(f"site_id: {self.site_id}, json_subset: {self.json_subset}, credentials: {credentials}")
|
|
40
|
+
|
|
41
|
+
def _refresh_credentials(self):
|
|
42
|
+
credentials = self.interfaces.credentials.get(system="sharepoint", system_type=self.system_type)
|
|
43
|
+
credentials = credentials.get('data')
|
|
44
|
+
self.access_token = credentials['access_token']
|
|
37
45
|
|
|
38
46
|
def _get_sharepoint_headers(self):
|
|
39
|
-
|
|
40
|
-
headers = {'Authorization': f'Bearer {access_token}'}
|
|
47
|
+
self._refresh_credentials()
|
|
48
|
+
headers = {'Authorization': f'Bearer {self.access_token}'}
|
|
41
49
|
if self.debug:
|
|
42
50
|
print(headers)
|
|
43
51
|
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='brynq_sdk_sharepoint',
|
|
5
|
-
version='
|
|
5
|
+
version='3.1.0',
|
|
6
6
|
description='Sharepoint wrapper from BrynQ',
|
|
7
7
|
long_description='Sharepoint wrapper from BrynQ',
|
|
8
8
|
author='BrynQ',
|
|
@@ -10,8 +10,8 @@ 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
|
'requests>=2,<=3'
|
|
15
15
|
],
|
|
16
16
|
zip_safe=False,
|
|
17
|
-
)
|
|
17
|
+
)
|
|
File without changes
|
{brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{brynq_sdk_sharepoint-2.0.2 → brynq_sdk_sharepoint-3.1.0}/brynq_sdk_sharepoint.egg-info/not-zip-safe
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|