|
2 | 2 | import sys |
3 | 3 | import time |
4 | 4 |
|
5 | | -from google.protobuf import json_format |
6 | | -from google.protobuf.json_format import MessageToJson |
7 | | -from google.protobuf.json_format import MessageToDict |
8 | | -from fds.protobuf.stach.Package_pb2 import Package |
9 | | - |
10 | | -from fds.analyticsapi.engines.api_client import ApiClient |
11 | 5 | from fds.analyticsapi.engines import ComponentSummary |
12 | | -from fds.analyticsapi.engines.configuration import Configuration |
| 6 | +from fds.analyticsapi.engines.api.calculations_api import CalculationsApi |
13 | 7 | from fds.analyticsapi.engines.api.components_api import ComponentsApi |
14 | 8 | from fds.analyticsapi.engines.api.configurations_api import ConfigurationsApi |
15 | | -from fds.analyticsapi.engines.api.calculations_api import CalculationsApi |
16 | 9 | from fds.analyticsapi.engines.api.utility_api import UtilityApi |
| 10 | +from fds.analyticsapi.engines.api_client import ApiClient |
| 11 | +from fds.analyticsapi.engines.configuration import Configuration |
17 | 12 | from fds.analyticsapi.engines.models.calculation import Calculation |
18 | 13 | from fds.analyticsapi.engines.models.pa_calculation_parameters import PACalculationParameters |
19 | | -from fds.analyticsapi.engines.models.pa_identifier import PAIdentifier |
20 | 14 | from fds.analyticsapi.engines.models.pa_date_parameters import PADateParameters |
| 15 | +from fds.analyticsapi.engines.models.pa_identifier import PAIdentifier |
21 | 16 | from fds.analyticsapi.engines.models.spar_calculation_parameters import SPARCalculationParameters |
22 | | -from fds.analyticsapi.engines.models.spar_identifier import SPARIdentifier |
23 | 17 | from fds.analyticsapi.engines.models.spar_date_parameters import SPARDateParameters |
| 18 | +from fds.analyticsapi.engines.models.spar_identifier import SPARIdentifier |
24 | 19 | from fds.analyticsapi.engines.models.vault_calculation_parameters import VaultCalculationParameters |
25 | | -from fds.analyticsapi.engines.models.vault_identifier import VaultIdentifier |
26 | 20 | from fds.analyticsapi.engines.models.vault_date_parameters import VaultDateParameters |
| 21 | +from fds.analyticsapi.engines.models.vault_identifier import VaultIdentifier |
| 22 | +from fds.protobuf.stach.Package_pb2 import Package |
| 23 | + |
| 24 | +from google.protobuf import json_format |
| 25 | +from google.protobuf.json_format import MessageToJson |
| 26 | +from google.protobuf.json_format import MessageToDict |
27 | 27 | from urllib3 import Retry |
28 | 28 |
|
29 | 29 | # Copy 'Converting API output to Table Format' snippet to a file with name 'stach_extensions.py' to use below import statement |
|
63 | 63 | # config.proxy = "<proxyUrl>" |
64 | 64 | config.verify_ssl = False |
65 | 65 |
|
| 66 | +# Setting configuration to retry api calls on http status codes of 429 and 503. |
66 | 67 | config.retries = Retry(total=3, status=3, status_forcelist=frozenset([429, 503]), backoff_factor=2, raise_on_status=False) |
67 | 68 |
|
68 | 69 | api_client = ApiClient(config) |
|
71 | 72 |
|
72 | 73 | components = components_api.get_pa_components(pa_document_name) |
73 | 74 | pa_component_desc = ComponentSummary(name=pa_component_name, category=pa_component_category) |
74 | | -component_id = [x for x in list(components.keys()) if components[x] == pa_component_desc][0] |
| 75 | +component_id = [id for id in list(components.keys()) if components[id] == pa_component_desc][0] |
75 | 76 |
|
76 | 77 | pa_account_identifier = PAIdentifier(pa_benchmark_sp_50) |
77 | 78 | pa_accounts = [pa_account_identifier] |
|
83 | 84 |
|
84 | 85 | components = components_api.get_spar_components(spar_document_name) |
85 | 86 | spar_component_desc = ComponentSummary(name=spar_component_name, category=spar_component_category) |
86 | | -component_id = [x for x in list(components.keys()) if components[x] == spar_component_desc][0] |
| 87 | +component_id = [id for id in list(components.keys()) if components[id] == spar_component_desc][0] |
87 | 88 |
|
88 | 89 | spar_account_identifier = SPARIdentifier(spar_benchmark_r_1000, spar_benchmark_russell_return_type, spar_benchmark_russell_prefix) |
89 | 90 | spar_accounts = [spar_account_identifier] |
|
94 | 95 |
|
95 | 96 | components = components_api.get_vault_components(vault_document_name) |
96 | 97 | vault_component_desc = ComponentSummary(name=vault_component_name, category=vault_component_category) |
97 | | -component_id = [x for x in list(components.keys()) if components[x] == vault_component_desc][0] |
| 98 | +component_id = [id for id in list(components.keys()) if components[id] == vault_component_desc][0] |
98 | 99 |
|
99 | 100 | vault_account_identifier = VaultIdentifier(vault_default_account) |
100 | 101 | vault_dates = VaultDateParameters(vault_startdate, vault_enddate, frequency) |
|
0 commit comments