brynq-sdk-ftp 2.0.7__tar.gz → 3.0.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_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/PKG-INFO +1 -1
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp/ftps.py +16 -10
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp/sftp.py +4 -4
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp.egg-info/PKG-INFO +1 -1
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp.egg-info/requires.txt +1 -1
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/setup.py +2 -2
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp/__init__.py +0 -0
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp.egg-info/not-zip-safe +0 -0
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/brynq_sdk_ftp.egg-info/top_level.txt +0 -0
- {brynq_sdk_ftp-2.0.7 → brynq_sdk_ftp-3.0.0}/setup.cfg +0 -0
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import ftplib
|
|
4
4
|
import time
|
|
5
5
|
from ftplib import FTP
|
|
6
|
-
from typing import Union, List
|
|
6
|
+
from typing import Union, List, Optional, Literal
|
|
7
7
|
from tenacity import retry, stop_after_attempt, wait_exponential_jitter, retry_if_exception
|
|
8
8
|
|
|
9
9
|
|
|
@@ -17,19 +17,25 @@ def is_ftp_exception(e: BaseException) -> bool:
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class FTPS(BrynQ):
|
|
20
|
-
def __init__(self,
|
|
20
|
+
def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug=False):
|
|
21
21
|
super().__init__()
|
|
22
|
-
|
|
23
|
-
credentials = self.
|
|
22
|
+
try:
|
|
23
|
+
credentials = self.interfaces.credentials.get(system="ftps", system_type=system_type)
|
|
24
|
+
credentials = credentials.get('data')
|
|
24
25
|
self.host = credentials['host']
|
|
25
26
|
self.username = credentials['username']
|
|
26
27
|
self.password = credentials['password']
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
self.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
except ValueError:
|
|
29
|
+
print("No FTPS credentials found")
|
|
30
|
+
self.host = None
|
|
31
|
+
# if no credentials are retrieved from the platform, fallback to Qlik FTP (can only be target, never source)
|
|
32
|
+
if self.host is None:
|
|
33
|
+
if system_type == 'target' and os.getenv("QLIK_HOST") is not None and os.getenv("QLIK_USER") is not None and os.getenv("QLIK_PASSWORD") is not None:
|
|
34
|
+
self.host = os.getenv("QLIK_HOST")
|
|
35
|
+
self.username = os.getenv("QLIK_USER")
|
|
36
|
+
self.password = os.getenv("QLIK_PASSWORD")
|
|
37
|
+
else:
|
|
38
|
+
raise ValueError("Set the environment variables QLIK_HOST, QLIK_USER and QLIK_PASSWORD or connect an FTPS authorization to your interface in BrynQ")
|
|
33
39
|
self.debug = debug
|
|
34
40
|
|
|
35
41
|
@retry(stop=stop_after_attempt(5), wait=wait_exponential_jitter(initial=60, max=900), retry=retry_if_exception(is_ftp_exception), reraise=True)
|
|
@@ -4,21 +4,21 @@ from paramiko.client import SSHClient, AutoAddPolicy
|
|
|
4
4
|
from paramiko import RSAKey
|
|
5
5
|
from paramiko.sftp_attr import SFTPAttributes
|
|
6
6
|
import pysftp
|
|
7
|
-
from typing import Union, List
|
|
7
|
+
from typing import Union, List, Literal, Optional
|
|
8
8
|
from stat import S_ISREG
|
|
9
9
|
import os
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class SFTP(BrynQ):
|
|
13
|
-
def __init__(self,
|
|
13
|
+
def __init__(self, system_type: Optional[Literal['source', 'target']] = None, debug=False):
|
|
14
14
|
"""
|
|
15
15
|
Init the SFTP class
|
|
16
16
|
:param label: The label of the connector
|
|
17
17
|
:param debug: If you want to see debug messages
|
|
18
18
|
"""
|
|
19
19
|
super().__init__()
|
|
20
|
-
|
|
21
|
-
credentials =
|
|
20
|
+
credentials = self.interfaces.credentials.get(system="sftp", system_type=system_type)
|
|
21
|
+
credentials = credentials.get('data')
|
|
22
22
|
self.debug = debug
|
|
23
23
|
if self.debug:
|
|
24
24
|
print(credentials)
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='brynq_sdk_ftp',
|
|
5
|
-
version='
|
|
5
|
+
version='3.0.0',
|
|
6
6
|
description='FTP wrapper from BrynQ',
|
|
7
7
|
long_description='FTP 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
|
'requests>=2,<=3',
|
|
15
15
|
'paramiko>=2,<=4',
|
|
16
16
|
'pysftp>0.2,<1',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|