solax-py-library 1.0.0.2__tar.gz → 1.0.0.3__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.2 → solax_py_library-1.0.0.3}/PKG-INFO +1 -1
  2. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/pyproject.toml +1 -1
  3. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/core/data_adapter/csv.py +1 -1
  4. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/core/upload_service/ftp.py +8 -4
  5. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/types/ftp.py +1 -1
  6. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/README.md +0 -0
  7. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/__init__.py +0 -0
  8. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/main.py +0 -0
  9. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/__init__.py +0 -0
  10. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/api/__init__.py +0 -0
  11. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/api/service.py +0 -0
  12. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/core/__init__.py +0 -0
  13. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/core/data_adapter/__init__.py +0 -0
  14. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/core/data_adapter/base.py +0 -0
  15. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/core/upload_service/__init__.py +0 -0
  16. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/core/upload_service/base.py +0 -0
  17. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/errors/__init__.py +0 -0
  18. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/errors/base.py +0 -0
  19. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/errors/upload_error.py +0 -0
  20. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/test/__init__.py +0 -0
  21. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/test/test_ftp.py +0 -0
  22. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/types/__init__.py +0 -0
  23. {solax_py_library-1.0.0.2 → solax_py_library-1.0.0.3}/solax_py_library/upload/types/client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: solax-py-library
3
- Version: 1.0.0.2
3
+ Version: 1.0.0.3
4
4
  Summary: some common tool
5
5
  Author: shenlvyu
6
6
  Author-email: 13296718439@163.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "solax-py-library"
3
- version = "1.0.0.2"
3
+ version = "1.0.0.3"
4
4
  description = "some common tool"
5
5
  authors = ["shenlvyu <13296718439@163.com>"]
6
6
  readme = "README.md"
@@ -23,4 +23,4 @@ class CSVDataAdapter(BaseDataAdapter):
23
23
  temp_file_path = temp_file.name
24
24
  temp_file.seek(0)
25
25
 
26
- return open(temp_file_path, "rb")
26
+ return temp_file_path
@@ -61,20 +61,24 @@ class FTPUploadService(BaseUploadService):
61
61
  raise NotImplementedError
62
62
  return FTPParsedData(
63
63
  file_name=upload_data.build_full_path(self.remote_path) + upload_data.file_type.get_file_suffix(),
64
- data=parsed_data
64
+ file_path=parsed_data
65
65
  )
66
66
 
67
67
  def _upload(self, data: FTPParsedData):
68
68
  try:
69
69
  if not self._is_connect:
70
70
  raise ConnectError(message="not connect yet")
71
- self._client.storbinary(
72
- f"STOR {self._build_remote_file(data.file_name)}", data.data
73
- )
71
+ with open(data.file_path, "rb") as f:
72
+ self._client.storbinary(
73
+ f"STOR {self._build_remote_file(data.file_name)}", f
74
+ )
74
75
  print(f"Successfully uploaded to {data.file_name}")
75
76
  except Exception as e:
76
77
  print(e)
77
78
  raise SendDataError
79
+ finally:
80
+ if os.path.exists(data.file_path):
81
+ os.remove(data.file_path)
78
82
 
79
83
  def _build_remote_file(self, file_name):
80
84
  return os.path.join(self.remote_path, file_name)
@@ -32,4 +32,4 @@ class FTPServiceConfig(BaseModel):
32
32
 
33
33
  class FTPParsedData(BaseModel):
34
34
  file_name: str
35
- data: Any
35
+ file_path: str