tyba-client 0.4.15__py3-none-any.whl → 0.4.17__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.
Potentially problematic release.
This version of tyba-client might be problematic. Click here for more details.
- tyba_client/operations.py +61 -1
- {tyba_client-0.4.15.dist-info → tyba_client-0.4.17.dist-info}/METADATA +3 -2
- {tyba_client-0.4.15.dist-info → tyba_client-0.4.17.dist-info}/RECORD +5 -6
- {tyba_client-0.4.15.dist-info → tyba_client-0.4.17.dist-info}/WHEEL +1 -1
- tyba_client-0.4.15.dist-info/LICENSE +0 -21
- /LICENSE → /tyba_client-0.4.17.dist-info/LICENSE +0 -0
tyba_client/operations.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import datetime
|
|
2
|
+
import json
|
|
2
3
|
from datetime import date
|
|
3
|
-
from typing import Optional
|
|
4
|
+
from typing import Optional, Literal
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Operations(object):
|
|
@@ -12,6 +13,10 @@ class Operations(object):
|
|
|
12
13
|
response.raise_for_status()
|
|
13
14
|
return response.text
|
|
14
15
|
|
|
16
|
+
|
|
17
|
+
def post(self, route, json):
|
|
18
|
+
return self.client.post(f"operations/{route}", json=json)
|
|
19
|
+
|
|
15
20
|
def performance_report(
|
|
16
21
|
self,
|
|
17
22
|
start_date: date,
|
|
@@ -82,3 +87,58 @@ class Operations(object):
|
|
|
82
87
|
if org_id:
|
|
83
88
|
params["org_id"] = org_id
|
|
84
89
|
return self.get("internal_api/assets", params=params)
|
|
90
|
+
|
|
91
|
+
def set_asset_overrides(
|
|
92
|
+
self,
|
|
93
|
+
asset_names: list[str],
|
|
94
|
+
field: str,
|
|
95
|
+
aggregation: Literal["global", "single_day", "single_day_hourly", "12x24"],
|
|
96
|
+
values,
|
|
97
|
+
service: Optional[str] = None,
|
|
98
|
+
date: Optional[datetime.date] = None,
|
|
99
|
+
):
|
|
100
|
+
assumption = {
|
|
101
|
+
"field": field,
|
|
102
|
+
"data": {"aggregation":aggregation }
|
|
103
|
+
}
|
|
104
|
+
match aggregation:
|
|
105
|
+
case "12x24":
|
|
106
|
+
assumption["data"] = {"aggregation": "12x24"} | values
|
|
107
|
+
case "single_day_hourly":
|
|
108
|
+
assumption["data"] = {
|
|
109
|
+
"aggregation": "single_day_hourly",
|
|
110
|
+
"date": date,
|
|
111
|
+
"values": values
|
|
112
|
+
}
|
|
113
|
+
case "single_day":
|
|
114
|
+
assumption["data"] = {
|
|
115
|
+
"aggregation": "single_day",
|
|
116
|
+
"values": values,
|
|
117
|
+
"date": date
|
|
118
|
+
}
|
|
119
|
+
case "global":
|
|
120
|
+
assumption["data"] = {
|
|
121
|
+
"aggregation": "global",
|
|
122
|
+
"value": values
|
|
123
|
+
}
|
|
124
|
+
if service:
|
|
125
|
+
assumption["service"] = service
|
|
126
|
+
request_data = {"asset_names": asset_names, "assumption": assumption}
|
|
127
|
+
|
|
128
|
+
res = self.post("internal_api/assets/override/", json=request_data)
|
|
129
|
+
if res.status_code != 200:
|
|
130
|
+
return {
|
|
131
|
+
"status_code": res.status_code,
|
|
132
|
+
"reason": res.reason,
|
|
133
|
+
"message": res.text
|
|
134
|
+
}
|
|
135
|
+
else:
|
|
136
|
+
return json.loads(res.text)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def overrides_schema(
|
|
141
|
+
self,
|
|
142
|
+
):
|
|
143
|
+
|
|
144
|
+
return json.loads(self.get("internal_api/overrides_schema"))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: tyba-client
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.17
|
|
4
4
|
Summary: A Python API client for the Tyba Public API
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Tyler Nisonoff
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
17
|
Requires-Dist: dataclasses-json (>=0.6.4,<0.7.0)
|
|
17
18
|
Requires-Dist: generation-models (>=0.10.6,<0.11.0)
|
|
18
19
|
Requires-Dist: marshmallow (>=3.12.1,<4.0.0)
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
LICENSE,sha256=LbMfEdjEK-IRzvCfdEBhn9UCANze0Rc7hWrQTEj_xvU,1079
|
|
2
1
|
tyba_client/__init__.py,sha256=42STGor_9nKYXumfeV5tiyD_M8VdcddX7CEexmibPBk,22
|
|
3
2
|
tyba_client/client.py,sha256=RAvjZkjWDDeY4eJXD2oELF4E1DOa02AqAcvWftsxISY,23295
|
|
4
3
|
tyba_client/forecast.py,sha256=P9GuKPrTCQpdxatSPCck5dezfMIe7otCjOiylyPVh-s,8383
|
|
5
4
|
tyba_client/io.py,sha256=0FVRtUjSDzyWYBvIMSJH7bCclCRqD2Y-pbcsJ-Ufyo0,6226
|
|
6
5
|
tyba_client/models.py,sha256=NOo39qStMkWBhfLPkUu37MaKMe3E2yFc5KAzUnFy96M,17569
|
|
7
|
-
tyba_client/operations.py,sha256=
|
|
6
|
+
tyba_client/operations.py,sha256=ZVJ90ow0JFFdS6eXBjonyNYrQx83eQfEXt02Eo657ik,4168
|
|
8
7
|
tyba_client/solar_resource.py,sha256=0Jte2cZpE-USHeW-qac4AN1mI2tmrC-VSahnbs4v3Bs,3683
|
|
9
8
|
tyba_client/utils.py,sha256=n4tUBGlQIwxbLqJcQRiAIbIJA0DaLSjbAxakhukqaeE,876
|
|
10
|
-
tyba_client-0.4.
|
|
11
|
-
tyba_client-0.4.
|
|
12
|
-
tyba_client-0.4.
|
|
13
|
-
tyba_client-0.4.
|
|
9
|
+
tyba_client-0.4.17.dist-info/LICENSE,sha256=LbMfEdjEK-IRzvCfdEBhn9UCANze0Rc7hWrQTEj_xvU,1079
|
|
10
|
+
tyba_client-0.4.17.dist-info/METADATA,sha256=3RtGOZcTcFG4AOCBz7514b1o8AS1tX3zV_-qHExXPJU,1324
|
|
11
|
+
tyba_client-0.4.17.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
12
|
+
tyba_client-0.4.17.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Tyba Energy.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
File without changes
|