@@ -33,20 +33,20 @@ class EasClient:
3333 """
3434
3535 def __init__ (
36- self ,
37- host : str ,
38- port : int ,
39- protocol : str = "https" ,
40- client_id : Optional [str ] = None ,
41- username : Optional [str ] = None ,
42- password : Optional [str ] = None ,
43- access_token : Optional [str ] = None ,
44- client_secret : Optional [str ] = None ,
45- token_fetcher : Optional [ZepbenTokenFetcher ] = None ,
46- verify_certificate : bool = True ,
47- ca_filename : Optional [str ] = None ,
48- session : ClientSession = None ,
49- json_serialiser = None
36+ self ,
37+ host : str ,
38+ port : int ,
39+ protocol : str = "https" ,
40+ client_id : Optional [str ] = None ,
41+ username : Optional [str ] = None ,
42+ password : Optional [str ] = None ,
43+ access_token : Optional [str ] = None ,
44+ client_secret : Optional [str ] = None ,
45+ token_fetcher : Optional [ZepbenTokenFetcher ] = None ,
46+ verify_certificate : bool = True ,
47+ ca_filename : Optional [str ] = None ,
48+ session : ClientSession = None ,
49+ json_serialiser = None
5050 ):
5151 """
5252 Construct a client for the Evolve App Server. If the server is HTTPS, authentication may be configured.
@@ -420,10 +420,10 @@ async def async_get_work_package_cost_estimation(self, work_package: WorkPackage
420420 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
421421
422422 async with self .session .post (
423- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
424- headers = self ._get_request_headers (),
425- json = json ,
426- ssl = sslcontext if self ._verify_certificate else False
423+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
424+ headers = self ._get_request_headers (),
425+ json = json ,
426+ ssl = sslcontext if self ._verify_certificate else False
427427 ) as response :
428428 if response .ok :
429429 response = await response .json ()
@@ -654,10 +654,10 @@ async def async_run_hosting_capacity_work_package(self, work_package: WorkPackag
654654 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
655655
656656 async with self .session .post (
657- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
658- headers = self ._get_request_headers (),
659- json = json ,
660- ssl = sslcontext if self ._verify_certificate else False
657+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
658+ headers = self ._get_request_headers (),
659+ json = json ,
660+ ssl = sslcontext if self ._verify_certificate else False
661661 ) as response :
662662 if response .ok :
663663 response = await response .json ()
@@ -696,10 +696,10 @@ async def async_cancel_hosting_capacity_work_package(self, work_package_id: str)
696696 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
697697
698698 async with self .session .post (
699- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
700- headers = self ._get_request_headers (),
701- json = json ,
702- ssl = sslcontext if self ._verify_certificate else False
699+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
700+ headers = self ._get_request_headers (),
701+ json = json ,
702+ ssl = sslcontext if self ._verify_certificate else False
703703 ) as response :
704704 if response .ok :
705705 response = await response .json ()
@@ -748,10 +748,10 @@ async def async_get_hosting_capacity_work_packages_progress(self):
748748 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
749749
750750 async with self .session .post (
751- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
752- headers = self ._get_request_headers (),
753- json = json ,
754- ssl = sslcontext if self ._verify_certificate else False
751+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
752+ headers = self ._get_request_headers (),
753+ json = json ,
754+ ssl = sslcontext if self ._verify_certificate else False
755755 ) as response :
756756 if response .ok :
757757 response = await response .json ()
@@ -796,7 +796,7 @@ async def async_run_feeder_load_analysis_report(self, feeder_load_analysis_input
796796 "fetchLvNetwork" : feeder_load_analysis_input .fetch_lv_network ,
797797 "processFeederLoads" : feeder_load_analysis_input .process_feeder_loads ,
798798 "processCoincidentLoads" : feeder_load_analysis_input .process_coincident_loads ,
799- "produceConductorReport" : True , # We currently only support conductor report
799+ "produceConductorReport" : True , # We currently only support conductor report
800800 "aggregateAtFeederLevel" : feeder_load_analysis_input .aggregate_at_feeder_level ,
801801 "output" : feeder_load_analysis_input .output
802802 }
@@ -806,10 +806,10 @@ async def async_run_feeder_load_analysis_report(self, feeder_load_analysis_input
806806 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
807807
808808 async with self .session .post (
809- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
810- headers = self ._get_request_headers (),
811- json = json ,
812- ssl = sslcontext if self ._verify_certificate else False
809+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
810+ headers = self ._get_request_headers (),
811+ json = json ,
812+ ssl = sslcontext if self ._verify_certificate else False
813813 ) as response :
814814 if response .ok :
815815 response = await response .json ()
@@ -915,10 +915,10 @@ async def async_run_ingestor(self, run_config: List[IngestorConfigInput]):
915915 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
916916
917917 async with self .session .post (
918- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
919- headers = self ._get_request_headers (),
920- json = json ,
921- ssl = sslcontext if self ._verify_certificate else False
918+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
919+ headers = self ._get_request_headers (),
920+ json = json ,
921+ ssl = sslcontext if self ._verify_certificate else False
922922 ) as response :
923923 if response .ok :
924924 response = await response .json ()
@@ -1052,8 +1052,7 @@ async def async_get_ingestor_run_list(self, query_filter: Optional[IngestorRunsF
10521052 response = await response .text ()
10531053 return response
10541054
1055- def run_hosting_capacity_calibration (self , calibration_name : str , local_calibration_time : Optional [str ] = None ,
1056- feeders : Optional [List [str ]] = None ):
1055+ def run_hosting_capacity_calibration (self , calibration_name : str , local_calibration_time : Optional [str ] = None , feeders : Optional [List [str ]] = None ):
10571056 """
10581057 Send request to run hosting capacity calibration
10591058 :param calibration_name: A string representation of the calibration name
@@ -1065,8 +1064,7 @@ def run_hosting_capacity_calibration(self, calibration_name: str, local_calibrat
10651064 self .async_run_hosting_capacity_calibration (calibration_name , local_calibration_time , feeders ))
10661065
10671066 async def async_run_hosting_capacity_calibration (self , calibration_name : str ,
1068- calibration_time_local : Optional [str ] = None ,
1069- feeders : Optional [List [str ]] = None ):
1067+ calibration_time_local : Optional [str ] = None , feeders : Optional [List [str ]] = None ):
10701068 """
10711069 Send asynchronous request to run hosting capacity calibration
10721070 :param calibration_name: A string representation of the calibration name
@@ -1094,10 +1092,10 @@ async def async_run_hosting_capacity_calibration(self, calibration_name: str,
10941092 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
10951093
10961094 async with self .session .post (
1097- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1098- headers = self ._get_request_headers (),
1099- json = json ,
1100- ssl = sslcontext if self ._verify_certificate else False
1095+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1096+ headers = self ._get_request_headers (),
1097+ json = json ,
1098+ ssl = sslcontext if self ._verify_certificate else False
11011099 ) as response :
11021100 if response .ok :
11031101 response = await response .json ()
@@ -1147,10 +1145,10 @@ async def async_get_hosting_capacity_calibration_run(self, id: str):
11471145 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
11481146
11491147 async with self .session .post (
1150- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1151- headers = self ._get_request_headers (),
1152- json = json ,
1153- ssl = sslcontext if self ._verify_certificate else False
1148+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1149+ headers = self ._get_request_headers (),
1150+ json = json ,
1151+ ssl = sslcontext if self ._verify_certificate else False
11541152 ) as response :
11551153 if response .ok :
11561154 response = await response .json ()
@@ -1184,10 +1182,10 @@ async def async_get_hosting_capacity_calibration_sets(self):
11841182 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
11851183
11861184 async with self .session .post (
1187- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1188- headers = self ._get_request_headers (),
1189- json = json ,
1190- ssl = sslcontext if self ._verify_certificate else False
1185+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1186+ headers = self ._get_request_headers (),
1187+ json = json ,
1188+ ssl = sslcontext if self ._verify_certificate else False
11911189 ) as response :
11921190 if response .ok :
11931191 response = await response .json ()
@@ -1231,16 +1229,16 @@ async def async_run_opendss_export(self, config: OpenDssConfig):
12311229 "modulesConfiguration" : {
12321230 "common" : {
12331231 ** ({"fixedTime" : {"loadTime" : config .load_time .load_time .isoformat (),
1234- "overrides" : config .load_time .load_overrides and [
1235- {
1236- "loadId" : key ,
1237- "loadWattsOverride" : value .load_watts ,
1238- "genWattsOverride" : value .gen_watts ,
1239- "loadVarOverride" : value .load_var ,
1240- "genVarOverride" : value .gen_var ,
1241- } for key , value in config .load_time .load_overrides .items ()
1242- ]
1243- }} if isinstance (config .load_time , FixedTime ) else {}),
1232+ "overrides" : config .load_time .load_overrides and [
1233+ {
1234+ "loadId" : key ,
1235+ "loadWattsOverride" : value .load_watts ,
1236+ "genWattsOverride" : value .gen_watts ,
1237+ "loadVarOverride" : value .load_var ,
1238+ "genVarOverride" : value .gen_var ,
1239+ } for key , value in config .load_time .load_overrides .items ()
1240+ ]
1241+ }} if isinstance (config .load_time , FixedTime ) else {}),
12441242 ** ({"timePeriod" : {
12451243 "startTime" : config .load_time .start_time .isoformat (),
12461244 "endTime" : config .load_time .end_time .isoformat (),
@@ -1341,10 +1339,10 @@ async def async_run_opendss_export(self, config: OpenDssConfig):
13411339 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
13421340
13431341 async with self .session .post (
1344- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1345- headers = self ._get_request_headers (),
1346- json = json ,
1347- ssl = sslcontext if self ._verify_certificate else False
1342+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1343+ headers = self ._get_request_headers (),
1344+ json = json ,
1345+ ssl = sslcontext if self ._verify_certificate else False
13481346 ) as response :
13491347 if response .ok :
13501348 response = await response .json ()
@@ -1353,11 +1351,11 @@ async def async_run_opendss_export(self, config: OpenDssConfig):
13531351 return response
13541352
13551353 def get_paged_opendss_models (
1356- self ,
1357- limit : Optional [int ] = None ,
1358- offset : Optional [int ] = None ,
1359- query_filter : Optional [GetOpenDssModelsFilterInput ] = None ,
1360- query_sort : Optional [GetOpenDssModelsSortCriteriaInput ] = None ):
1354+ self ,
1355+ limit : Optional [int ] = None ,
1356+ offset : Optional [int ] = None ,
1357+ query_filter : Optional [GetOpenDssModelsFilterInput ] = None ,
1358+ query_sort : Optional [GetOpenDssModelsSortCriteriaInput ] = None ):
13611359 """
13621360 Retrieve a paginated opendss export run information
13631361 :param limit: The number of opendss export runs to retrieve
@@ -1370,11 +1368,11 @@ def get_paged_opendss_models(
13701368 self .async_get_paged_opendss_models (limit , offset , query_filter , query_sort ))
13711369
13721370 async def async_get_paged_opendss_models (
1373- self ,
1374- limit : Optional [int ] = None ,
1375- offset : Optional [int ] = None ,
1376- query_filter : Optional [GetOpenDssModelsFilterInput ] = None ,
1377- query_sort : Optional [GetOpenDssModelsSortCriteriaInput ] = None ):
1371+ self ,
1372+ limit : Optional [int ] = None ,
1373+ offset : Optional [int ] = None ,
1374+ query_filter : Optional [GetOpenDssModelsFilterInput ] = None ,
1375+ query_sort : Optional [GetOpenDssModelsSortCriteriaInput ] = None ):
13781376 """
13791377 Retrieve a paginated opendss export run information
13801378 :param limit: The number of opendss export runs to retrieve
@@ -1531,10 +1529,10 @@ async def async_get_paged_opendss_models(
15311529 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
15321530
15331531 async with self .session .post (
1534- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1535- headers = self ._get_request_headers (),
1536- json = json ,
1537- ssl = sslcontext if self ._verify_certificate else False
1532+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1533+ headers = self ._get_request_headers (),
1534+ json = json ,
1535+ ssl = sslcontext if self ._verify_certificate else False
15381536 ) as response :
15391537 if response .ok :
15401538 response = await response .json ()
@@ -1564,11 +1562,11 @@ async def async_get_opendss_model_download_url(self, run_id: int):
15641562 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
15651563
15661564 async with self .session .get (
1567- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port ,
1568- path = f"/api/opendss-model/{ run_id } " ),
1569- headers = self ._get_request_headers (),
1570- ssl = sslcontext if self ._verify_certificate else False ,
1571- allow_redirects = False
1565+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port ,
1566+ path = f"/api/opendss-model/{ run_id } " ),
1567+ headers = self ._get_request_headers (),
1568+ ssl = sslcontext if self ._verify_certificate else False ,
1569+ allow_redirects = False
15721570 ) as response :
15731571 if response .status == HTTPStatus .FOUND :
15741572 response = response .headers ["Location" ]
0 commit comments