@@ -35,20 +35,20 @@ class EasClient:
3535 """
3636
3737 def __init__ (
38- self ,
39- host : str ,
40- port : int ,
41- protocol : str = "https" ,
42- client_id : Optional [str ] = None ,
43- username : Optional [str ] = None ,
44- password : Optional [str ] = None ,
45- access_token : Optional [str ] = None ,
46- client_secret : Optional [str ] = None ,
47- token_fetcher : Optional [ZepbenTokenFetcher ] = None ,
48- verify_certificate : bool = True ,
49- ca_filename : Optional [str ] = None ,
50- session : ClientSession = None ,
51- json_serialiser = None
38+ self ,
39+ host : str ,
40+ port : int ,
41+ protocol : str = "https" ,
42+ client_id : Optional [str ] = None ,
43+ username : Optional [str ] = None ,
44+ password : Optional [str ] = None ,
45+ access_token : Optional [str ] = None ,
46+ client_secret : Optional [str ] = None ,
47+ token_fetcher : Optional [ZepbenTokenFetcher ] = None ,
48+ verify_certificate : bool = True ,
49+ ca_filename : Optional [str ] = None ,
50+ session : ClientSession = None ,
51+ json_serialiser = None
5252 ):
5353 """
5454 Construct a client for the Evolve App Server. If the server is HTTPS, authentication may be configured.
@@ -422,10 +422,10 @@ async def async_get_work_package_cost_estimation(self, work_package: WorkPackage
422422 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
423423
424424 async with self .session .post (
425- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
426- headers = self ._get_request_headers (),
427- json = json ,
428- ssl = sslcontext if self ._verify_certificate else False
425+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
426+ headers = self ._get_request_headers (),
427+ json = json ,
428+ ssl = sslcontext if self ._verify_certificate else False
429429 ) as response :
430430 if response .ok :
431431 return await response .json ()
@@ -655,10 +655,10 @@ async def async_run_hosting_capacity_work_package(self, work_package: WorkPackag
655655 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
656656
657657 async with self .session .post (
658- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
659- headers = self ._get_request_headers (),
660- json = json ,
661- ssl = sslcontext if self ._verify_certificate else False
658+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
659+ headers = self ._get_request_headers (),
660+ json = json ,
661+ ssl = sslcontext if self ._verify_certificate else False
662662 ) as response :
663663 if response .ok :
664664 return 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 return await response .json ()
@@ -747,10 +747,10 @@ async def async_get_hosting_capacity_work_packages_progress(self):
747747 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
748748
749749 async with self .session .post (
750- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
751- headers = self ._get_request_headers (),
752- json = json ,
753- ssl = sslcontext if self ._verify_certificate else False
750+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
751+ headers = self ._get_request_headers (),
752+ json = json ,
753+ ssl = sslcontext if self ._verify_certificate else False
754754 ) as response :
755755 if response .ok :
756756 return await response .json ()
@@ -794,7 +794,7 @@ async def async_run_feeder_load_analysis_report(self, feeder_load_analysis_input
794794 "fetchLvNetwork" : feeder_load_analysis_input .fetch_lv_network ,
795795 "processFeederLoads" : feeder_load_analysis_input .process_feeder_loads ,
796796 "processCoincidentLoads" : feeder_load_analysis_input .process_coincident_loads ,
797- "produceConductorReport" : True , # We currently only support conductor report
797+ "produceConductorReport" : True , # We currently only support conductor report
798798 "aggregateAtFeederLevel" : feeder_load_analysis_input .aggregate_at_feeder_level ,
799799 "output" : feeder_load_analysis_input .output
800800 }
@@ -804,10 +804,10 @@ async def async_run_feeder_load_analysis_report(self, feeder_load_analysis_input
804804 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
805805
806806 async with self .session .post (
807- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
808- headers = self ._get_request_headers (),
809- json = json ,
810- ssl = sslcontext if self ._verify_certificate else False
807+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
808+ headers = self ._get_request_headers (),
809+ json = json ,
810+ ssl = sslcontext if self ._verify_certificate else False
811811 ) as response :
812812 if response .ok :
813813 return await response .json ()
@@ -868,10 +868,10 @@ async def async_upload_study(self, study: Study):
868868 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
869869
870870 async with self .session .post (
871- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
872- headers = self ._get_request_headers (),
873- json = json ,
874- ssl = sslcontext if self ._verify_certificate else False
871+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
872+ headers = self ._get_request_headers (),
873+ json = json ,
874+ ssl = sslcontext if self ._verify_certificate else False
875875 ) as response :
876876 if response .ok :
877877 return await response .json ()
@@ -1177,10 +1177,10 @@ async def async_run_hosting_capacity_calibration(self, calibration_name: str,
11771177 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
11781178
11791179 async with self .session .post (
1180- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1181- headers = self ._get_request_headers (),
1182- json = json ,
1183- ssl = sslcontext if self ._verify_certificate else False
1180+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1181+ headers = self ._get_request_headers (),
1182+ json = json ,
1183+ ssl = sslcontext if self ._verify_certificate else False
11841184 ) as response :
11851185 if response .ok :
11861186 return await response .json ()
@@ -1229,10 +1229,10 @@ async def async_get_hosting_capacity_calibration_run(self, id: str):
12291229 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
12301230
12311231 async with self .session .post (
1232- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1233- headers = self ._get_request_headers (),
1234- json = json ,
1235- ssl = sslcontext if self ._verify_certificate else False
1232+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1233+ headers = self ._get_request_headers (),
1234+ json = json ,
1235+ ssl = sslcontext if self ._verify_certificate else False
12361236 ) as response :
12371237 if response .ok :
12381238 return await response .json ()
@@ -1265,27 +1265,24 @@ async def async_get_hosting_capacity_calibration_sets(self):
12651265 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
12661266
12671267 async with self .session .post (
1268- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1269- headers = self ._get_request_headers (),
1270- json = json ,
1271- ssl = sslcontext if self ._verify_certificate else False
1268+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1269+ headers = self ._get_request_headers (),
1270+ json = json ,
1271+ ssl = sslcontext if self ._verify_certificate else False
12721272 ) as response :
12731273 if response .ok :
12741274 return await response .json ()
12751275 else :
12761276 response .raise_for_status ()
12771277
1278- def get_transformer_tap_settings (self , calibration_id : str , feeder : Optional [str ] = None ,
1279- transformer_mrid : Optional [str ] = None ):
1278+ def get_transformer_tap_settings (self , calibration_id : str , feeder : Optional [str ] = None , transformer_mrid : Optional [str ] = None ):
12801279 """
12811280 Retrieve distribution transformer tap settings from a calibration set in the hosting capacity input database.
12821281 :return: The HTTP response received from the Evolve App Server after requesting transformer tap settings for the calibration id
12831282 """
1284- return get_event_loop ().run_until_complete (
1285- self .async_get_transformer_tap_settings (calibration_id , feeder , transformer_mrid ))
1283+ return get_event_loop ().run_until_complete (self .async_get_transformer_tap_settings (calibration_id , feeder , transformer_mrid ))
12861284
1287- async def async_get_transformer_tap_settings (self , calibration_id : str , feeder : Optional [str ] = None ,
1288- transformer_mrid : Optional [str ] = None ):
1285+ async def async_get_transformer_tap_settings (self , calibration_id : str , feeder : Optional [str ] = None , transformer_mrid : Optional [str ] = None ):
12891286 """
12901287 Retrieve distribution transformer tap settings from a calibration set in the hosting capacity input database.
12911288 :return: The HTTP response received from the Evolve App Server after requesting transformer tap settings for the calibration id
@@ -1317,10 +1314,10 @@ async def async_get_transformer_tap_settings(self, calibration_id: str, feeder:
13171314 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
13181315
13191316 async with self .session .post (
1320- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1321- headers = self ._get_request_headers (),
1322- json = json ,
1323- ssl = sslcontext if self ._verify_certificate else False
1317+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1318+ headers = self ._get_request_headers (),
1319+ json = json ,
1320+ ssl = sslcontext if self ._verify_certificate else False
13241321 ) as response :
13251322 if response .ok :
13261323 return await response .json ()
@@ -1363,16 +1360,16 @@ async def async_run_opendss_export(self, config: OpenDssConfig):
13631360 "modulesConfiguration" : {
13641361 "common" : {
13651362 ** ({"fixedTime" : {"loadTime" : config .load_time .load_time .isoformat (),
1366- "overrides" : config .load_time .load_overrides and [
1367- {
1368- "loadId" : key ,
1369- "loadWattsOverride" : value .load_watts ,
1370- "genWattsOverride" : value .gen_watts ,
1371- "loadVarOverride" : value .load_var ,
1372- "genVarOverride" : value .gen_var ,
1373- } for key , value in config .load_time .load_overrides .items ()
1374- ]
1375- }} if isinstance (config .load_time , FixedTime ) else {}),
1363+ "overrides" : config .load_time .load_overrides and [
1364+ {
1365+ "loadId" : key ,
1366+ "loadWattsOverride" : value .load_watts ,
1367+ "genWattsOverride" : value .gen_watts ,
1368+ "loadVarOverride" : value .load_var ,
1369+ "genVarOverride" : value .gen_var ,
1370+ } for key , value in config .load_time .load_overrides .items ()
1371+ ]
1372+ }} if isinstance (config .load_time , FixedTime ) else {}),
13761373 ** ({"timePeriod" : {
13771374 "startTime" : config .load_time .start_time .isoformat (),
13781375 "endTime" : config .load_time .end_time .isoformat (),
@@ -1473,22 +1470,22 @@ async def async_run_opendss_export(self, config: OpenDssConfig):
14731470 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
14741471
14751472 async with self .session .post (
1476- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1477- headers = self ._get_request_headers (),
1478- json = json ,
1479- ssl = sslcontext if self ._verify_certificate else False
1473+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1474+ headers = self ._get_request_headers (),
1475+ json = json ,
1476+ ssl = sslcontext if self ._verify_certificate else False
14801477 ) as response :
14811478 if response .ok :
14821479 return await response .json ()
14831480 else :
14841481 response .raise_for_status ()
14851482
14861483 def get_paged_opendss_models (
1487- self ,
1488- limit : Optional [int ] = None ,
1489- offset : Optional [int ] = None ,
1490- query_filter : Optional [GetOpenDssModelsFilterInput ] = None ,
1491- query_sort : Optional [GetOpenDssModelsSortCriteriaInput ] = None ):
1484+ self ,
1485+ limit : Optional [int ] = None ,
1486+ offset : Optional [int ] = None ,
1487+ query_filter : Optional [GetOpenDssModelsFilterInput ] = None ,
1488+ query_sort : Optional [GetOpenDssModelsSortCriteriaInput ] = None ):
14921489 """
14931490 Retrieve a paginated opendss export run information
14941491 :param limit: The number of opendss export runs to retrieve
@@ -1501,11 +1498,11 @@ def get_paged_opendss_models(
15011498 self .async_get_paged_opendss_models (limit , offset , query_filter , query_sort ))
15021499
15031500 async def async_get_paged_opendss_models (
1504- self ,
1505- limit : Optional [int ] = None ,
1506- offset : Optional [int ] = None ,
1507- query_filter : Optional [GetOpenDssModelsFilterInput ] = None ,
1508- query_sort : Optional [GetOpenDssModelsSortCriteriaInput ] = None ):
1501+ self ,
1502+ limit : Optional [int ] = None ,
1503+ offset : Optional [int ] = None ,
1504+ query_filter : Optional [GetOpenDssModelsFilterInput ] = None ,
1505+ query_sort : Optional [GetOpenDssModelsSortCriteriaInput ] = None ):
15091506 """
15101507 Retrieve a paginated opendss export run information
15111508 :param limit: The number of opendss export runs to retrieve
@@ -1662,10 +1659,10 @@ async def async_get_paged_opendss_models(
16621659 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
16631660
16641661 async with self .session .post (
1665- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1666- headers = self ._get_request_headers (),
1667- json = json ,
1668- ssl = sslcontext if self ._verify_certificate else False
1662+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port , path = "/api/graphql" ),
1663+ headers = self ._get_request_headers (),
1664+ json = json ,
1665+ ssl = sslcontext if self ._verify_certificate else False
16691666 ) as response :
16701667 if response .ok :
16711668 return await response .json ()
@@ -1694,11 +1691,11 @@ async def async_get_opendss_model_download_url(self, run_id: int):
16941691 sslcontext = ssl .create_default_context (cafile = self ._ca_filename )
16951692
16961693 async with self .session .get (
1697- construct_url (protocol = self ._protocol , host = self ._host , port = self ._port ,
1698- path = f"/api/opendss-model/{ run_id } " ),
1699- headers = self ._get_request_headers (),
1700- ssl = sslcontext if self ._verify_certificate else False ,
1701- allow_redirects = False
1694+ construct_url (protocol = self ._protocol , host = self ._host , port = self ._port ,
1695+ path = f"/api/opendss-model/{ run_id } " ),
1696+ headers = self ._get_request_headers (),
1697+ ssl = sslcontext if self ._verify_certificate else False ,
1698+ allow_redirects = False
17021699 ) as response :
17031700 if response .status == HTTPStatus .FOUND :
17041701 return response .headers ["Location" ]
0 commit comments