solax-py-library 1.0.0.3__py3-none-any.whl → 1.0.0.5__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/api/service.py +2 -2
- solax_py_library/upload/core/data_adapter/csv.py +1 -1
- solax_py_library/upload/core/upload_service/base.py +1 -1
- solax_py_library/upload/core/upload_service/ftp.py +4 -3
- solax_py_library/upload/test/test_ftp.py +14 -4
- {solax_py_library-1.0.0.3.dist-info → solax_py_library-1.0.0.5.dist-info}/METADATA +1 -1
- {solax_py_library-1.0.0.3.dist-info → solax_py_library-1.0.0.5.dist-info}/RECORD +8 -9
- solax_py_library/main.py +0 -7
- {solax_py_library-1.0.0.3.dist-info → solax_py_library-1.0.0.5.dist-info}/WHEEL +0 -0
@@ -16,9 +16,9 @@ def upload_service(upload_type: UploadType, configuration: Dict[str, Any]):
|
|
16
16
|
return upload_class(**configuration)
|
17
17
|
|
18
18
|
|
19
|
-
def upload(
|
19
|
+
async def upload(
|
20
20
|
upload_type: UploadType, configuration: Dict[str, Any], upload_data: UploadData
|
21
21
|
):
|
22
22
|
service = upload_service(upload_type, configuration)
|
23
23
|
with service as s:
|
24
|
-
s.upload(upload_data)
|
24
|
+
await s.upload(upload_data)
|
@@ -9,7 +9,7 @@ class CSVDataAdapter(BaseDataAdapter):
|
|
9
9
|
@classmethod
|
10
10
|
def parse_data(cls, data: Union[List[List[Any]], List[Dict[str, Any]]]):
|
11
11
|
with tempfile.NamedTemporaryFile(
|
12
|
-
delete=False, mode="w", newline="", encoding="
|
12
|
+
delete=False, mode="w", newline="", encoding="utf-8-sig"
|
13
13
|
) as temp_file:
|
14
14
|
if isinstance(data[0], list):
|
15
15
|
writer = csv.writer(temp_file)
|
@@ -2,7 +2,7 @@ import ftplib
|
|
2
2
|
import os
|
3
3
|
|
4
4
|
from .base import BaseUploadService
|
5
|
-
from solax_py_library.upload.types.client import UploadType
|
5
|
+
from solax_py_library.upload.types.client import UploadType
|
6
6
|
from solax_py_library.upload.core.data_adapter import CSVDataAdapter
|
7
7
|
from solax_py_library.upload.types.ftp import (
|
8
8
|
FTPServiceConfig,
|
@@ -60,8 +60,9 @@ class FTPUploadService(BaseUploadService):
|
|
60
60
|
else:
|
61
61
|
raise NotImplementedError
|
62
62
|
return FTPParsedData(
|
63
|
-
file_name=upload_data.build_full_path(self.remote_path)
|
64
|
-
|
63
|
+
file_name=upload_data.build_full_path(self.remote_path)
|
64
|
+
+ upload_data.file_type.get_file_suffix(),
|
65
|
+
file_path=parsed_data,
|
65
66
|
)
|
66
67
|
|
67
68
|
def _upload(self, data: FTPParsedData):
|
@@ -1,8 +1,9 @@
|
|
1
|
+
import asyncio
|
1
2
|
import unittest
|
2
3
|
|
3
4
|
from solax_py_library.upload.api.service import upload
|
4
5
|
from solax_py_library.upload.types.client import UploadType, UploadData
|
5
|
-
from solax_py_library.upload.types.ftp import
|
6
|
+
from solax_py_library.upload.types.ftp import FTPFileType
|
6
7
|
|
7
8
|
|
8
9
|
class FTPTest(unittest.TestCase):
|
@@ -13,7 +14,7 @@ class FTPTest(unittest.TestCase):
|
|
13
14
|
"password": "sly402",
|
14
15
|
"remote_path": "/xixi",
|
15
16
|
}
|
16
|
-
upload(
|
17
|
+
asyncio.run(upload(
|
17
18
|
upload_type=UploadType.FTP,
|
18
19
|
configuration=ftp_config,
|
19
20
|
upload_data=UploadData(
|
@@ -21,7 +22,16 @@ class FTPTest(unittest.TestCase):
|
|
21
22
|
data=dict(
|
22
23
|
file_type=FTPFileType.CSV,
|
23
24
|
file_name="new_file.csv",
|
24
|
-
data=[
|
25
|
+
data=[
|
26
|
+
{
|
27
|
+
"EMS1000序列号": "XMG11A011L",
|
28
|
+
"EMS1000本地时间": "2025-02-11 15:39:10",
|
29
|
+
"EMS1000版本号": "V007.11.1",
|
30
|
+
"电站所在国家和地区": None,
|
31
|
+
"电站所在当前时区": None,
|
32
|
+
"电站系统类型": None,
|
33
|
+
}
|
34
|
+
],
|
25
35
|
),
|
26
36
|
),
|
27
|
-
)
|
37
|
+
))
|
@@ -1,23 +1,22 @@
|
|
1
1
|
solax_py_library/__init__.py,sha256=qihwuOWhDJufT29zzCp1aGWTLNRvTWZzEjgqWCTgCmQ,21
|
2
|
-
solax_py_library/main.py,sha256=gmPEDTm72i1IhTuWH__pAHeK8Y7PdAlpVSu0kUPqP5U,269
|
3
2
|
solax_py_library/upload/__init__.py,sha256=M9vBP5Q1mD-hs-voqWNXtzLDKq1FBuFHSLw6a8WhP0E,85
|
4
3
|
solax_py_library/upload/api/__init__.py,sha256=ASShe-YQxP0aA3B_I8EmpWKXIdXPWvaANifrzlYrFEk,84
|
5
|
-
solax_py_library/upload/api/service.py,sha256=
|
4
|
+
solax_py_library/upload/api/service.py,sha256=ubFepgkG4pQwFAH_f1JJ-mU8ZZrNf9zUMyQ_wy9QN7s,774
|
6
5
|
solax_py_library/upload/core/__init__.py,sha256=XMcnyDzCfsLwWaTAZt9-an7TuwYFqVNSt9W1_QRUrwA,89
|
7
6
|
solax_py_library/upload/core/data_adapter/__init__.py,sha256=9CXepLZSOjZMfNjyYKAWQCWZt353kTL_0tFBlIeUIOo,116
|
8
7
|
solax_py_library/upload/core/data_adapter/base.py,sha256=Va-SEe0eL3gobhNOnzHGkYBLIwf5RVawQdYRHHXg9g0,170
|
9
|
-
solax_py_library/upload/core/data_adapter/csv.py,sha256=
|
8
|
+
solax_py_library/upload/core/data_adapter/csv.py,sha256=8nlnV_43mMAR3re50MQJymzT5HYpZOo7eSeMsEfnEVE,861
|
10
9
|
solax_py_library/upload/core/upload_service/__init__.py,sha256=uA-UeH31rDNxByeZwvPhNFHPV_-J8JyCev8geuc---k,269
|
11
|
-
solax_py_library/upload/core/upload_service/base.py,sha256=
|
12
|
-
solax_py_library/upload/core/upload_service/ftp.py,sha256=
|
10
|
+
solax_py_library/upload/core/upload_service/base.py,sha256=Mi1KFKy80-ssyJ1x3kgDxOeTpSM26cZI7YSW5UrAzs4,887
|
11
|
+
solax_py_library/upload/core/upload_service/ftp.py,sha256=uQda33G-Pyz80qUzCUSYrLSDD1Swod2FxsRM_dbufFE,2652
|
13
12
|
solax_py_library/upload/errors/__init__.py,sha256=pVAcSOXvlsPJW3PjHLBOdbl7KvntiYmz7TP0XuRwZ_A,243
|
14
13
|
solax_py_library/upload/errors/base.py,sha256=T01ZrZHF25PWgCrOv76Vhg26hds3I1Yy8Kl2LZRKOxo,258
|
15
14
|
solax_py_library/upload/errors/upload_error.py,sha256=9pCZzR_y3-VkBWSs5w7mMHYFRJjzVosIcxi-5SO8N1U,409
|
16
15
|
solax_py_library/upload/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
solax_py_library/upload/test/test_ftp.py,sha256=
|
16
|
+
solax_py_library/upload/test/test_ftp.py,sha256=lCuPgi1VOW_JTq9m7tlyxhR64x4oE0F1y0Dlv9lmz0I,1298
|
18
17
|
solax_py_library/upload/types/__init__.py,sha256=og9KBpYbcs36_S1izURj3vyHeuNOLJQrD9GpxK_JJaw,244
|
19
18
|
solax_py_library/upload/types/client.py,sha256=IE4tw2KFRmZABptmujB7SXG2-61cW7X7qN9b2IrBF3Y,505
|
20
19
|
solax_py_library/upload/types/ftp.py,sha256=APxneZ9m1OwImr3xZWnNkhxlh5Wy5rNCdegcVuOLyEM,644
|
21
|
-
solax_py_library-1.0.0.
|
22
|
-
solax_py_library-1.0.0.
|
23
|
-
solax_py_library-1.0.0.
|
20
|
+
solax_py_library-1.0.0.5.dist-info/METADATA,sha256=W7YlNm0vaLcbnADeW6HGCj82hTCQ4GelDoQNs9tYWgU,670
|
21
|
+
solax_py_library-1.0.0.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
22
|
+
solax_py_library-1.0.0.5.dist-info/RECORD,,
|
solax_py_library/main.py
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
import os.path
|
2
|
-
import sys
|
3
|
-
|
4
|
-
current_directory = os.path.dirname(os.path.abspath(__file__))
|
5
|
-
parent_directory = os.path.abspath(os.path.join(current_directory, '..'))
|
6
|
-
target_file_path = os.path.join(parent_directory, "dependency")
|
7
|
-
sys.path.append(target_file_path)
|
File without changes
|