solax-py-library 0.1.0.5__py3-none-any.whl → 0.1.0.7__py3-none-any.whl
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.
- solax_py_library/upload/core/upload_service/ftp.py +14 -5
- solax_py_library/upload/types/client.py +3 -2
- solax_py_library/upload/types/ftp.py +1 -1
- {solax_py_library-0.1.0.5.dist-info → solax_py_library-0.1.0.7.dist-info}/METADATA +1 -1
- {solax_py_library-0.1.0.5.dist-info → solax_py_library-0.1.0.7.dist-info}/RECORD +6 -6
- {solax_py_library-0.1.0.5.dist-info → solax_py_library-0.1.0.7.dist-info}/WHEEL +0 -0
@@ -4,8 +4,17 @@ import os
|
|
4
4
|
from .base import BaseUploadService
|
5
5
|
from solax_py_library.upload.types.client import UploadType, UploadData
|
6
6
|
from solax_py_library.upload.core.data_adapter import CSVDataAdapter
|
7
|
-
from solax_py_library.upload.types.ftp import
|
8
|
-
|
7
|
+
from solax_py_library.upload.types.ftp import (
|
8
|
+
FTPServiceConfig,
|
9
|
+
FTPFileType,
|
10
|
+
FTPData,
|
11
|
+
FTPParsedData,
|
12
|
+
)
|
13
|
+
from solax_py_library.upload.errors.upload_error import (
|
14
|
+
SendDataError,
|
15
|
+
ConnectError,
|
16
|
+
ConfigurationError,
|
17
|
+
)
|
9
18
|
|
10
19
|
|
11
20
|
class FTPUploadService(BaseUploadService):
|
@@ -15,7 +24,7 @@ class FTPUploadService(BaseUploadService):
|
|
15
24
|
super().__init__(**kwargs)
|
16
25
|
config = self._init_config(**kwargs)
|
17
26
|
self.host = config.host
|
18
|
-
self.
|
27
|
+
self.user = config.user
|
19
28
|
self.password = config.password
|
20
29
|
self.remote_path = config.remote_path
|
21
30
|
|
@@ -31,7 +40,7 @@ class FTPUploadService(BaseUploadService):
|
|
31
40
|
self.close()
|
32
41
|
try:
|
33
42
|
self._client = ftplib.FTP(self.host)
|
34
|
-
self._client.login(self.
|
43
|
+
self._client.login(self.user, self.password)
|
35
44
|
print(f"Connected to {self.host}")
|
36
45
|
self._is_connect = True
|
37
46
|
except Exception as e:
|
@@ -46,7 +55,7 @@ class FTPUploadService(BaseUploadService):
|
|
46
55
|
print("Connection closed.")
|
47
56
|
|
48
57
|
def _parse(self, upload_data: UploadData) -> FTPParsedData:
|
49
|
-
data: FTPData = upload_data.
|
58
|
+
data: FTPData = upload_data.data
|
50
59
|
if data.file_type == FTPFileType.CSV:
|
51
60
|
parsed_data = CSVDataAdapter.parse_data(data.data)
|
52
61
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from enum import Enum
|
2
2
|
from pydantic import BaseModel
|
3
|
-
from typing import Optional
|
3
|
+
from typing import Optional, Union
|
4
4
|
|
5
5
|
from solax_py_library.upload.types.ftp import FTPData
|
6
6
|
|
@@ -10,4 +10,5 @@ class UploadType(str, Enum):
|
|
10
10
|
|
11
11
|
|
12
12
|
class UploadData(BaseModel):
|
13
|
-
|
13
|
+
data: Optional[Union[FTPData]]
|
14
|
+
upload_type: Optional[UploadType]
|
@@ -8,15 +8,15 @@ solax_py_library/upload/core/data_adapter/base.py,sha256=Va-SEe0eL3gobhNOnzHGkYB
|
|
8
8
|
solax_py_library/upload/core/data_adapter/csv.py,sha256=LR-45i1Guihrm_eN2Li9kNoutTAsiPeWQNTUz2HJmok,518
|
9
9
|
solax_py_library/upload/core/upload_service/__init__.py,sha256=uA-UeH31rDNxByeZwvPhNFHPV_-J8JyCev8geuc---k,269
|
10
10
|
solax_py_library/upload/core/upload_service/base.py,sha256=T6h0ws_bCVRL2AeIXmDpbfPWZzJnUGh5gJKTZoF1CSw,856
|
11
|
-
solax_py_library/upload/core/upload_service/ftp.py,sha256=
|
11
|
+
solax_py_library/upload/core/upload_service/ftp.py,sha256=ll7Q-KmWQVFtM9XFyVDNoY32Szx5CvATHe-KKOtDUiw,2455
|
12
12
|
solax_py_library/upload/errors/__init__.py,sha256=pVAcSOXvlsPJW3PjHLBOdbl7KvntiYmz7TP0XuRwZ_A,243
|
13
13
|
solax_py_library/upload/errors/base.py,sha256=T01ZrZHF25PWgCrOv76Vhg26hds3I1Yy8Kl2LZRKOxo,258
|
14
14
|
solax_py_library/upload/errors/upload_error.py,sha256=9pCZzR_y3-VkBWSs5w7mMHYFRJjzVosIcxi-5SO8N1U,409
|
15
15
|
solax_py_library/upload/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
solax_py_library/upload/test/test_ftp.py,sha256=mJcYdroFLpI82t2-8IVGXNYGWB9TVJK723uaQFcTFr4,856
|
17
17
|
solax_py_library/upload/types/__init__.py,sha256=og9KBpYbcs36_S1izURj3vyHeuNOLJQrD9GpxK_JJaw,244
|
18
|
-
solax_py_library/upload/types/client.py,sha256=
|
19
|
-
solax_py_library/upload/types/ftp.py,sha256=
|
20
|
-
solax_py_library-0.1.0.
|
21
|
-
solax_py_library-0.1.0.
|
22
|
-
solax_py_library-0.1.0.
|
18
|
+
solax_py_library/upload/types/client.py,sha256=PEUG7pulvwEb6NS6yiu5yYHowNI8UrUDygawfAkPIlo,294
|
19
|
+
solax_py_library/upload/types/ftp.py,sha256=RTREbHwvGz6hrz_VUaw8Rx5utB4LQisytcsI2jGT6zc,533
|
20
|
+
solax_py_library-0.1.0.7.dist-info/METADATA,sha256=hXXqrAI6oTOHqQcvRL1LWhcjKROx4zIbwdWCXdQJNVo,670
|
21
|
+
solax_py_library-0.1.0.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
22
|
+
solax_py_library-0.1.0.7.dist-info/RECORD,,
|
File without changes
|