solax-py-library 1.0.0.7__tar.gz → 1.0.0.9__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.
Files changed (23) hide show
  1. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/PKG-INFO +2 -3
  2. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/README.md +1 -2
  3. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/pyproject.toml +1 -1
  4. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/core/upload_service/ftp.py +2 -2
  5. solax_py_library-1.0.0.9/solax_py_library/upload/test/test_ftp.py +39 -0
  6. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/types/client.py +1 -1
  7. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/types/ftp.py +1 -1
  8. solax_py_library-1.0.0.7/solax_py_library/upload/test/test_ftp.py +0 -37
  9. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/__init__.py +0 -0
  10. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/__init__.py +0 -0
  11. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/api/__init__.py +0 -0
  12. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/api/service.py +0 -0
  13. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/core/__init__.py +0 -0
  14. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/core/data_adapter/__init__.py +0 -0
  15. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/core/data_adapter/base.py +0 -0
  16. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/core/data_adapter/csv.py +0 -0
  17. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/core/upload_service/__init__.py +0 -0
  18. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/core/upload_service/base.py +0 -0
  19. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/errors/__init__.py +0 -0
  20. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/errors/base.py +0 -0
  21. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/errors/upload_error.py +0 -0
  22. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/test/__init__.py +0 -0
  23. {solax_py_library-1.0.0.7 → solax_py_library-1.0.0.9}/solax_py_library/upload/types/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: solax-py-library
3
- Version: 1.0.0.7
3
+ Version: 1.0.0.9
4
4
  Summary: some common tool
5
5
  Author: shenlvyu
6
6
  Author-email: 13296718439@163.com
@@ -40,7 +40,7 @@ This package provide some general modules to help us can focus on the real proje
40
40
  - upload: The module define the upload tool.It support the way by Ftp.
41
41
 
42
42
 
43
- #### quick start
43
+ #### quick start
44
44
 
45
45
  ```python
46
46
  await upload(
@@ -66,4 +66,3 @@ await upload(
66
66
  )
67
67
  ```
68
68
 
69
-
@@ -22,7 +22,7 @@ This package provide some general modules to help us can focus on the real proje
22
22
  - upload: The module define the upload tool.It support the way by Ftp.
23
23
 
24
24
 
25
- #### quick start
25
+ #### quick start
26
26
 
27
27
  ```python
28
28
  await upload(
@@ -47,4 +47,3 @@ await upload(
47
47
  ),
48
48
  )
49
49
  ```
50
-
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "solax-py-library"
3
- version = "1.0.0.7"
3
+ version = "1.0.0.9"
4
4
  description = "some common tool"
5
5
  authors = ["shenlvyu <13296718439@163.com>"]
6
6
  readme = "README.md"
@@ -18,7 +18,7 @@ from solax_py_library.upload.errors.upload_error import (
18
18
 
19
19
 
20
20
  class FTPUploadService(BaseUploadService):
21
- upload_type = UploadType.FTP.value
21
+ upload_type = UploadType.FTP
22
22
 
23
23
  def __init__(self, **kwargs):
24
24
  super().__init__(**kwargs)
@@ -55,7 +55,7 @@ class FTPUploadService(BaseUploadService):
55
55
  print("Connection closed.")
56
56
 
57
57
  def _parse(self, upload_data: FTPData) -> FTPParsedData:
58
- if upload_data.file_type == FTPFileType.CSV.value:
58
+ if upload_data.file_type == FTPFileType.CSV:
59
59
  parsed_data = CSVDataAdapter.parse_data(upload_data.data)
60
60
  else:
61
61
  raise NotImplementedError
@@ -0,0 +1,39 @@
1
+ import asyncio
2
+ import unittest
3
+
4
+ from solax_py_library.upload.api.service import upload
5
+ from solax_py_library.upload.types.client import UploadType, UploadData
6
+ from solax_py_library.upload.types.ftp import FTPFileType
7
+
8
+
9
+ class FTPTest(unittest.TestCase):
10
+ def test_ftp_upload(self):
11
+ ftp_config = {
12
+ "host": "10.1.31.181", # 测试host
13
+ "user": "solax",
14
+ "password": "sly402",
15
+ "remote_path": "/xixi",
16
+ }
17
+ asyncio.run(
18
+ upload(
19
+ upload_type=UploadType.FTP,
20
+ configuration=ftp_config,
21
+ upload_data=UploadData(
22
+ upload_type=UploadType.FTP,
23
+ data=dict(
24
+ file_type=FTPFileType.CSV,
25
+ file_name="new_file",
26
+ data=[
27
+ {
28
+ "EMS1000序列号": "XMG11A011L",
29
+ "EMS1000本地时间": "2025-02-11 15:39:10",
30
+ "EMS1000版本号": "V007.11.1",
31
+ "电站所在国家和地区": None,
32
+ "电站所在当前时区": None,
33
+ "电站系统类型": None,
34
+ }
35
+ ],
36
+ ),
37
+ ),
38
+ )
39
+ )
@@ -15,5 +15,5 @@ class UploadData(BaseModel):
15
15
 
16
16
  def build_data(self):
17
17
  dict_obj_data = self.data if isinstance(self.data, dict) else self.data.dict()
18
- if self.upload_type == UploadType.FTP.value:
18
+ if self.upload_type == UploadType.FTP:
19
19
  return FTPData(**dict_obj_data)
@@ -11,7 +11,7 @@ class FTPFileType(IntEnum):
11
11
  @classmethod
12
12
  def get_file_suffix(cls, value):
13
13
  return {
14
- FTPFileType.CSV.value: ".csv",
14
+ FTPFileType.CSV: ".csv",
15
15
  }.get(value)
16
16
 
17
17
 
@@ -1,37 +0,0 @@
1
- import asyncio
2
- import unittest
3
-
4
- from solax_py_library.upload.api.service import upload
5
- from solax_py_library.upload.types.client import UploadType, UploadData
6
- from solax_py_library.upload.types.ftp import FTPFileType
7
-
8
-
9
- class FTPTest(unittest.TestCase):
10
- def test_ftp_upload(self):
11
- ftp_config = {
12
- "host": "10.1.31.181", # 测试host
13
- "user": "solax",
14
- "password": "sly402",
15
- "remote_path": "/xixi",
16
- }
17
- asyncio.run(upload(
18
- upload_type=UploadType.FTP.value,
19
- configuration=ftp_config,
20
- upload_data=UploadData(
21
- upload_type=UploadType.FTP.value,
22
- data=dict(
23
- file_type=FTPFileType.CSV.value,
24
- file_name="new_file",
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
- ],
35
- ),
36
- ),
37
- ))