ep-sdk-4pd 0.1.0__tar.gz → 0.1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ep_sdk_4pd
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: 4paradigm Electricity Platform Service SDK Library for Python
5
5
  Home-page: https://gitlab.4pd.io/electricityproject/electricity-platform-sdk
6
6
  Author: 4paradigm Electricity Platform SDK
@@ -0,0 +1 @@
1
+ __version__ = '0.1.1'
@@ -3,29 +3,41 @@ import json
3
3
  import requests
4
4
 
5
5
  from ep_sdk_4pd import models as ep_sdk_4pd_models
6
+ from ep_sdk_4pd.models import HistoryDataRequest
6
7
 
8
+ # test 地址
9
+ endpoint = 'http://172.27.88.56:6001'
7
10
 
8
- class Client:
9
- def __init__(
10
- self,
11
- config: ep_sdk_4pd_models.Config,
12
- ):
13
- self._endpoint = config.endpoint
14
11
 
12
+ # prod 地址
13
+ # endpoint = 'http://82.157.231.254:6001'
14
+
15
+ class EpData:
16
+
17
+ @staticmethod
18
+ def get_history_data(
19
+ scope,
20
+ system_date,
21
+ days
22
+ ):
23
+ request = HistoryDataRequest(
24
+ scope=scope,
25
+ system_date=system_date,
26
+ days=days,
27
+ )
28
+ response = EpData.history_data(request=request)
15
29
 
16
- # def __get_endpoint(self) -> None:
17
- # # test 地址
18
- # self._endpoint = 'http://172.27.88.56:6001'
19
- # # prod 地址
20
- # # self._endpoint = 'http://82.157.231.254:6001'
30
+ if response.code == 200:
31
+ return response.data
32
+ else:
33
+ return None
21
34
 
35
+ @staticmethod
22
36
  def history_data(
23
- self,
24
- request: ep_sdk_4pd_models.HistoryDataRequest = None,
37
+ request: ep_sdk_4pd_models.HistoryDataRequest = None,
25
38
  ) -> ep_sdk_4pd_models.HistoryDataResponse:
26
39
 
27
-
28
- full_url = f'{self._endpoint}{request.api}'
40
+ full_url = f'{endpoint}{request.api}'
29
41
  headers = {
30
42
  'content-type': request.content_type,
31
43
  }
@@ -1,16 +1,3 @@
1
- class Config:
2
- """
3
- Model for initing client
4
- """
5
-
6
- def __init__(
7
- self,
8
- ):
9
- # test 地址
10
- self.endpoint = 'http://172.27.88.56:6001'
11
- # prod 地址
12
- # self.endpoint = 'http://82.157.231.254:6001'
13
-
14
1
 
15
2
  class BaseRequest:
16
3
  """
@@ -37,27 +24,6 @@ class BaseResponse:
37
24
  self.message = message
38
25
 
39
26
 
40
- class TestRequest(BaseRequest):
41
-
42
- def __init__(self):
43
- super().__init__()
44
- self.api = '/ai/cpp/api/v1/audio-language-detection/test'
45
- self.method = 'POST'
46
- self.content_type = 'application/json'
47
- self.payload = {}
48
-
49
-
50
- class TestResponse(BaseResponse):
51
-
52
- def __init__(self, response: BaseResponse = None, **kwargs):
53
- super().__init__(
54
- code=response.code if response else None,
55
- data=response.data if response else None,
56
- message=response.message if response else None,
57
- **kwargs,
58
- )
59
-
60
-
61
27
  class HistoryDataRequest(BaseRequest):
62
28
  """
63
29
  Model for HistoryDataRequest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ep_sdk_4pd
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: 4paradigm Electricity Platform Service SDK Library for Python
5
5
  Home-page: https://gitlab.4pd.io/electricityproject/electricity-platform-sdk
6
6
  Author: 4paradigm Electricity Platform SDK
@@ -1,7 +1,7 @@
1
1
  README.md
2
2
  setup.py
3
3
  ep_sdk_4pd/__init__.py
4
- ep_sdk_4pd/client.py
4
+ ep_sdk_4pd/ep_data.py
5
5
  ep_sdk_4pd/models.py
6
6
  ep_sdk_4pd.egg-info/PKG-INFO
7
7
  ep_sdk_4pd.egg-info/SOURCES.txt
@@ -8,7 +8,7 @@ DESCRIPTION = '4paradigm Electricity Platform Service SDK Library for Python'
8
8
  AUTHOR = '4paradigm Electricity Platform SDK'
9
9
  AUTHOR_EMAIL = ''
10
10
  URL = 'https://gitlab.4pd.io/electricityproject/electricity-platform-sdk'
11
- VERSION = '0.1.0'
11
+ VERSION = '0.1.1'
12
12
  REQUIRES = ['requests']
13
13
 
14
14
  LONG_DESCRIPTION = ''
@@ -0,0 +1,13 @@
1
+ from ep_sdk_4pd.ep_data import EpData
2
+
3
+
4
+ def test_history_data():
5
+ print('-------------test client-------------')
6
+
7
+ data = EpData.get_history_data(scope="weather", system_date="2025-04-17", days=2)
8
+ print(data)
9
+ print('-------------------------------------')
10
+
11
+
12
+ if __name__ == '__main__':
13
+ test_history_data()
@@ -1 +0,0 @@
1
- __version__ = '0.1.0'
@@ -1,23 +0,0 @@
1
- import ep_sdk_4pd.client as ep_sdk_4pd_client
2
- import ep_sdk_4pd.models as ep_sdk_4pd_models
3
-
4
-
5
- def test_history_data():
6
- print('-------------test client-------------')
7
-
8
- config = ep_sdk_4pd_models.Config()
9
- client = ep_sdk_4pd_client.Client(config=config)
10
- request = ep_sdk_4pd_models.HistoryDataRequest(
11
- scope="weather",
12
- system_date="2025-04-17",
13
- days=2,
14
- )
15
- response = client.history_data(request=request)
16
- print(response.code)
17
- print(response.data)
18
- print(response.message)
19
- print('-------------------------------------')
20
-
21
-
22
- if __name__ == '__main__':
23
- test_history_data()
File without changes
File without changes