tyba-client 0.4.15__tar.gz → 0.4.16__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.
Potentially problematic release.
This version of tyba-client might be problematic. Click here for more details.
- {tyba_client-0.4.15 → tyba_client-0.4.16}/PKG-INFO +3 -2
- {tyba_client-0.4.15 → tyba_client-0.4.16}/pyproject.toml +1 -1
- {tyba_client-0.4.15 → tyba_client-0.4.16}/tyba_client/operations.py +61 -1
- {tyba_client-0.4.15 → tyba_client-0.4.16}/LICENSE +0 -0
- {tyba_client-0.4.15 → tyba_client-0.4.16}/PYPI_README.md +0 -0
- {tyba_client-0.4.15 → tyba_client-0.4.16}/tyba_client/__init__.py +0 -0
- {tyba_client-0.4.15 → tyba_client-0.4.16}/tyba_client/client.py +0 -0
- {tyba_client-0.4.15 → tyba_client-0.4.16}/tyba_client/forecast.py +0 -0
- {tyba_client-0.4.15 → tyba_client-0.4.16}/tyba_client/io.py +0 -0
- {tyba_client-0.4.15 → tyba_client-0.4.16}/tyba_client/models.py +0 -0
- {tyba_client-0.4.15 → tyba_client-0.4.16}/tyba_client/solar_resource.py +0 -0
- {tyba_client-0.4.15 → tyba_client-0.4.16}/tyba_client/utils.py +0 -0
|
@@ -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.16
|
|
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,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_hourly",
|
|
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"))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|