solax-py-library 1.0.0.1__py3-none-any.whl → 1.0.0.3__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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: solax-py-library
3
- Version: 1.0.0.1
3
+ Version: 1.0.0.3
4
4
  Summary: some common tool
5
5
  Author: shenlvyu
6
6
  Author-email: 13296718439@163.com
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Requires-Dist: pydantic (>=1.10.0,<2.0.0)
16
- Requires-Dist: typing-extensions (==4.7.2)
16
+ Requires-Dist: typing-extensions (==4.7.1)
17
17
  Description-Content-Type: text/markdown
18
18
 
19
19
  ### solax common module
@@ -6,10 +6,10 @@ solax_py_library/upload/api/service.py,sha256=RJ8oqIqsVA8d978UDGgNfxYTDJ44nWIfQB
6
6
  solax_py_library/upload/core/__init__.py,sha256=XMcnyDzCfsLwWaTAZt9-an7TuwYFqVNSt9W1_QRUrwA,89
7
7
  solax_py_library/upload/core/data_adapter/__init__.py,sha256=9CXepLZSOjZMfNjyYKAWQCWZt353kTL_0tFBlIeUIOo,116
8
8
  solax_py_library/upload/core/data_adapter/base.py,sha256=Va-SEe0eL3gobhNOnzHGkYBLIwf5RVawQdYRHHXg9g0,170
9
- solax_py_library/upload/core/data_adapter/csv.py,sha256=2hAtDdU2ibzg6hRcZgZiRVI9JAOEhzGzXlDcWmDYvqI,868
9
+ solax_py_library/upload/core/data_adapter/csv.py,sha256=1muBW01YzX9-SJH1TQoiYavEm8CrHDNsREwVYIpl4QI,856
10
10
  solax_py_library/upload/core/upload_service/__init__.py,sha256=uA-UeH31rDNxByeZwvPhNFHPV_-J8JyCev8geuc---k,269
11
11
  solax_py_library/upload/core/upload_service/base.py,sha256=vl6QTxcx-QVFv0J1VN7HSgh4opouKfTpmJDkwQYzLVU,881
12
- solax_py_library/upload/core/upload_service/ftp.py,sha256=O566dyVKTLrXVJq6KLXAnxn2Tk3YB6IxLqzm3nV45QU,2486
12
+ solax_py_library/upload/core/upload_service/ftp.py,sha256=tz7sFMqWPbFZBiybuNy0OF3XyB0GAni-g19Qgd_RR-k,2651
13
13
  solax_py_library/upload/errors/__init__.py,sha256=pVAcSOXvlsPJW3PjHLBOdbl7KvntiYmz7TP0XuRwZ_A,243
14
14
  solax_py_library/upload/errors/base.py,sha256=T01ZrZHF25PWgCrOv76Vhg26hds3I1Yy8Kl2LZRKOxo,258
15
15
  solax_py_library/upload/errors/upload_error.py,sha256=9pCZzR_y3-VkBWSs5w7mMHYFRJjzVosIcxi-5SO8N1U,409
@@ -17,7 +17,7 @@ solax_py_library/upload/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
17
17
  solax_py_library/upload/test/test_ftp.py,sha256=geXAU1LM4IIkQHEJ5w2yBVNOo5YN-h6dipIWgv5ukdE,1038
18
18
  solax_py_library/upload/types/__init__.py,sha256=og9KBpYbcs36_S1izURj3vyHeuNOLJQrD9GpxK_JJaw,244
19
19
  solax_py_library/upload/types/client.py,sha256=IE4tw2KFRmZABptmujB7SXG2-61cW7X7qN9b2IrBF3Y,505
20
- solax_py_library/upload/types/ftp.py,sha256=vHStILTntRAKrpRofnuEaNIvoDcmWnObU-5PSJaZQ58,639
21
- solax_py_library-1.0.0.1.dist-info/METADATA,sha256=h9pD_k2mqSSssMbmBD7Sl3rTaoIfqRFZCLPqXdmwcLs,670
22
- solax_py_library-1.0.0.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
23
- solax_py_library-1.0.0.1.dist-info/RECORD,,
20
+ solax_py_library/upload/types/ftp.py,sha256=APxneZ9m1OwImr3xZWnNkhxlh5Wy5rNCdegcVuOLyEM,644
21
+ solax_py_library-1.0.0.3.dist-info/METADATA,sha256=NkPg-sQ3Kf60hSYf5lMpXF-sHQUcsu0YHlpq82mNN9Y,670
22
+ solax_py_library-1.0.0.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
23
+ solax_py_library-1.0.0.3.dist-info/RECORD,,