lusid-sdk 2.1.137__py3-none-any.whl → 2.1.139__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 lusid-sdk might be problematic. Click here for more details.

lusid/__init__.py CHANGED
@@ -1083,6 +1083,7 @@ from lusid.extensions import (
1083
1083
  ConfigurationLoader,
1084
1084
  SecretsFileConfigurationLoader,
1085
1085
  EnvironmentVariablesConfigurationLoader,
1086
+ FileTokenConfigurationLoader,
1086
1087
  ArgsConfigurationLoader,
1087
1088
  SyncApiClient
1088
1089
  )
@@ -2149,6 +2150,8 @@ __all__ = [
2149
2150
  "ConfigurationLoader",
2150
2151
  "SecretsFileConfigurationLoader",
2151
2152
  "EnvironmentVariablesConfigurationLoader",
2153
+ "FileTokenConfigurationLoader",
2152
2154
  "ArgsConfigurationLoader",
2153
2155
  "SyncApiClient"
2156
+
2154
2157
  ]
lusid/configuration.py CHANGED
@@ -373,7 +373,7 @@ class Configuration:
373
373
  return "Python SDK Debug Report:\n"\
374
374
  "OS: {env}\n"\
375
375
  "Python Version: {pyversion}\n"\
376
- "Version of the API: 0.11.6571\n"\
376
+ "Version of the API: 0.11.6573\n"\
377
377
  "SDK Package Version: {package_version}".\
378
378
  format(env=sys.platform, pyversion=sys.version, package_version=package_version)
379
379
 
@@ -3,6 +3,7 @@ from lusid.extensions.configuration_loaders import (
3
3
  ConfigurationLoader,
4
4
  SecretsFileConfigurationLoader,
5
5
  EnvironmentVariablesConfigurationLoader,
6
+ FileTokenConfigurationLoader,
6
7
  ArgsConfigurationLoader,
7
8
  )
8
9
  from lusid.extensions.api_client import SyncApiClient
@@ -13,6 +14,7 @@ __all__ = [
13
14
  "ConfigurationLoader",
14
15
  "SecretsFileConfigurationLoader",
15
16
  "EnvironmentVariablesConfigurationLoader",
17
+ "FileTokenConfigurationLoader"
16
18
  "ArgsConfigurationLoader",
17
19
  "SyncApiClient"
18
20
  ]
@@ -1,9 +1,10 @@
1
1
  import json
2
2
  import os
3
- from typing import Dict, TextIO, Protocol, Union, Iterable
3
+ from typing import Dict, TextIO, Protocol, Union, Iterable, Optional
4
4
  import logging
5
5
  from lusid.extensions.proxy_config import ProxyConfig
6
6
  from lusid.extensions.api_configuration import ApiConfiguration
7
+ from lusid.extensions.file_access_token import FileAccessToken
7
8
 
8
9
  logger = logging.getLogger(__name__)
9
10
 
@@ -141,10 +142,34 @@ class EnvironmentVariablesConfigurationLoader:
141
142
  class ArgsConfigurationLoader:
142
143
  """ConfigurationLoader which loads in config from kwargs in constructor
143
144
  """
144
- def __init__(self, **kwargs):
145
+ def __init__(self,
146
+ token_url:Optional[str]=None,
147
+ api_url:Optional[str]=None,
148
+ username:Optional[str]=None,
149
+ password:Optional[str]=None,
150
+ client_id:Optional[str]=None,
151
+ client_secret:Optional[str]=None,
152
+ app_name:Optional[str]=None,
153
+ certificate_filename:Optional[str]=None,
154
+ proxy_address:Optional[str]=None,
155
+ proxy_username:Optional[str]=None,
156
+ proxy_password:Optional[str]=None,
157
+ access_token:Optional[str]=None
158
+ ):
145
159
  """kwargs passed to this constructor used to build ApiConfiguration
146
160
  """
147
- self._kwargs = kwargs
161
+ self.__token_url = token_url
162
+ self.__api_url = api_url
163
+ self.__username = username
164
+ self.__password = password
165
+ self.__client_id = client_id
166
+ self.__client_secret = client_secret
167
+ self.__app_name = app_name
168
+ self.__certificate_filename = certificate_filename
169
+ self.__proxy_address = proxy_address
170
+ self.__proxy_username = proxy_username
171
+ self.__proxy_password = proxy_password
172
+ self.__access_token = access_token
148
173
 
149
174
  def load_config(self) -> Dict[str, str]:
150
175
  """load configuration from kwargs passed to constructor
@@ -155,13 +180,51 @@ class ArgsConfigurationLoader:
155
180
  dictionary that can be loaded into an ApiConfiguration object
156
181
  """
157
182
  logger.debug("loading config from arguments passed to ArgsConfigurationLoader")
158
- keys = ENVIRONMENT_CONFIG_KEYS.keys()
159
- return {key: self._kwargs.get(key) for key in keys}
183
+ return {
184
+ "token_url" : self.__token_url,
185
+ "api_url" : self.__api_url,
186
+ "username" : self.__username,
187
+ "password" : self.__password,
188
+ "client_id" : self.__client_id,
189
+ "client_secret" : self.__client_secret,
190
+ "app_name" : self.__app_name,
191
+ "certificate_filename" : self.__certificate_filename,
192
+ "proxy_address" : self.__proxy_address,
193
+ "proxy_username" : self.__proxy_username,
194
+ "proxy_password" : self.__proxy_password,
195
+ "access_token" : self.__access_token
196
+ }
197
+
198
+
199
+ class FileTokenConfigurationLoader:
200
+ """ConfigurationLoader which loads in access token from file
201
+ if FBN_ACCESS_TOKEN_FILE is set,
202
+ or if an access_token_location is passed to the initialiser
203
+ """
204
+
205
+ def __init__(
206
+ self, access_token_location: str = os.getenv("FBN_ACCESS_TOKEN_FILE", "")
207
+ ):
208
+ self.access_token = None
209
+ # if neither are provided we won't want to override config from other loaders
210
+ if access_token_location is not None and access_token_location != "":
211
+ self.access_token = FileAccessToken(access_token_location)
212
+
213
+ def load_config(self) -> Dict[str, FileAccessToken | None]:
214
+ """load access token from file
215
+
216
+ Returns
217
+ -------
218
+ Dict[str, str]
219
+ dictionary that can be loaded into an ApiConfiguration object
220
+ """
221
+ return {"access_token": self.access_token}
160
222
 
161
223
 
162
224
  default_config_loaders = (
163
225
  EnvironmentVariablesConfigurationLoader(),
164
226
  SecretsFileConfigurationLoader(api_secrets_file="secrets.json"),
227
+ FileTokenConfigurationLoader()
165
228
  )
166
229
 
167
230
  def get_api_configuration(config_loaders: Iterable[ConfigurationLoader]) -> ApiConfiguration:
@@ -0,0 +1,42 @@
1
+ import collections
2
+ import datetime
3
+ import logging
4
+
5
+ logger = logging.getLogger(__name__)
6
+
7
+
8
+ class FileAccessToken(collections.UserString):
9
+ """Loads access token from file when requested
10
+ Acts as a string so can be concatenated to auth headers
11
+ """
12
+
13
+ def __init__(self, access_token_location: str, expiry_time:int = 120):
14
+ if access_token_location is None or access_token_location == "":
15
+ raise ValueError("access_token_location must be a non-empty string")
16
+ self.__access_token_location = access_token_location
17
+ self.__expiry_time = expiry_time
18
+ self.__token_data = {
19
+ "expires": datetime.datetime.now(),
20
+ "current_access_token": "",
21
+ }
22
+
23
+ @property
24
+ def data(self) -> str:
25
+ """load access token from file
26
+
27
+ Returns
28
+ -------
29
+ str
30
+ Access token
31
+ """
32
+ if self.__token_data["expires"] <= datetime.datetime.now():
33
+ try:
34
+ with open(self.__access_token_location, "r") as access_token_file:
35
+ self.__token_data["current_access_token"] = access_token_file.read()
36
+ self.__token_data["expires"] = (
37
+ datetime.datetime.now() + datetime.timedelta(seconds=self.__expiry_time)
38
+ )
39
+ except OSError:
40
+ logger.error("Could not open access token file")
41
+ raise
42
+ return self.__token_data["current_access_token"]
@@ -37,8 +37,9 @@ class ApplicableInstrumentEvent(BaseModel):
37
37
  instrument_event_id: constr(strict=True, min_length=1) = Field(..., alias="instrumentEventId")
38
38
  generated_event: InstrumentEventHolder = Field(..., alias="generatedEvent")
39
39
  loaded_event: InstrumentEventHolder = Field(..., alias="loadedEvent")
40
+ applied_instrument_event_instruction_id: constr(strict=True, min_length=1) = Field(..., alias="appliedInstrumentEventInstructionId")
40
41
  transactions: conlist(Transaction) = Field(...)
41
- __properties = ["portfolioId", "holdingId", "lusidInstrumentId", "instrumentScope", "instrumentType", "instrumentEventType", "instrumentEventId", "generatedEvent", "loadedEvent", "transactions"]
42
+ __properties = ["portfolioId", "holdingId", "lusidInstrumentId", "instrumentScope", "instrumentType", "instrumentEventType", "instrumentEventId", "generatedEvent", "loadedEvent", "appliedInstrumentEventInstructionId", "transactions"]
42
43
 
43
44
  class Config:
44
45
  """Pydantic configuration"""
@@ -101,6 +102,7 @@ class ApplicableInstrumentEvent(BaseModel):
101
102
  "instrument_event_id": obj.get("instrumentEventId"),
102
103
  "generated_event": InstrumentEventHolder.from_dict(obj.get("generatedEvent")) if obj.get("generatedEvent") is not None else None,
103
104
  "loaded_event": InstrumentEventHolder.from_dict(obj.get("loadedEvent")) if obj.get("loadedEvent") is not None else None,
105
+ "applied_instrument_event_instruction_id": obj.get("appliedInstrumentEventInstructionId"),
104
106
  "transactions": [Transaction.from_dict(_item) for _item in obj.get("transactions")] if obj.get("transactions") is not None else None
105
107
  })
106
108
  return _obj
@@ -21,6 +21,7 @@ import json
21
21
  from typing import Any, Dict, List, Optional
22
22
  from pydantic.v1 import BaseModel, Field, StrictStr, conlist
23
23
  from lusid.models.link import Link
24
+ from lusid.models.property_value import PropertyValue
24
25
  from lusid.models.staged_modification_effective_range import StagedModificationEffectiveRange
25
26
 
26
27
  class StagedModificationsRequestedChangeInterval(BaseModel):
@@ -29,8 +30,8 @@ class StagedModificationsRequestedChangeInterval(BaseModel):
29
30
  """
30
31
  attribute_name: Optional[StrictStr] = Field(None, alias="attributeName", description="Name of the property the change applies to.")
31
32
  effective_range: Optional[StagedModificationEffectiveRange] = Field(None, alias="effectiveRange")
32
- previous_value: Optional[Any] = Field(None, alias="previousValue", description="The previous value of the attribute before the requested change is applied.")
33
- new_value: Optional[Any] = Field(None, alias="newValue", description="The value of the attribute once the requested change is applied.")
33
+ previous_value: Optional[PropertyValue] = Field(None, alias="previousValue")
34
+ new_value: Optional[PropertyValue] = Field(None, alias="newValue")
34
35
  as_at_basis: Optional[StrictStr] = Field(None, alias="asAtBasis", description="Whether the change represents the modification when the request was made or the modification as it would be at the latest time.")
35
36
  links: Optional[conlist(Link)] = None
36
37
  __properties = ["attributeName", "effectiveRange", "previousValue", "newValue", "asAtBasis", "links"]
@@ -62,6 +63,12 @@ class StagedModificationsRequestedChangeInterval(BaseModel):
62
63
  # override the default output from pydantic by calling `to_dict()` of effective_range
63
64
  if self.effective_range:
64
65
  _dict['effectiveRange'] = self.effective_range.to_dict()
66
+ # override the default output from pydantic by calling `to_dict()` of previous_value
67
+ if self.previous_value:
68
+ _dict['previousValue'] = self.previous_value.to_dict()
69
+ # override the default output from pydantic by calling `to_dict()` of new_value
70
+ if self.new_value:
71
+ _dict['newValue'] = self.new_value.to_dict()
65
72
  # override the default output from pydantic by calling `to_dict()` of each item in links (list)
66
73
  _items = []
67
74
  if self.links:
@@ -74,16 +81,6 @@ class StagedModificationsRequestedChangeInterval(BaseModel):
74
81
  if self.attribute_name is None and "attribute_name" in self.__fields_set__:
75
82
  _dict['attributeName'] = None
76
83
 
77
- # set to None if previous_value (nullable) is None
78
- # and __fields_set__ contains the field
79
- if self.previous_value is None and "previous_value" in self.__fields_set__:
80
- _dict['previousValue'] = None
81
-
82
- # set to None if new_value (nullable) is None
83
- # and __fields_set__ contains the field
84
- if self.new_value is None and "new_value" in self.__fields_set__:
85
- _dict['newValue'] = None
86
-
87
84
  # set to None if as_at_basis (nullable) is None
88
85
  # and __fields_set__ contains the field
89
86
  if self.as_at_basis is None and "as_at_basis" in self.__fields_set__:
@@ -108,8 +105,8 @@ class StagedModificationsRequestedChangeInterval(BaseModel):
108
105
  _obj = StagedModificationsRequestedChangeInterval.parse_obj({
109
106
  "attribute_name": obj.get("attributeName"),
110
107
  "effective_range": StagedModificationEffectiveRange.from_dict(obj.get("effectiveRange")) if obj.get("effectiveRange") is not None else None,
111
- "previous_value": obj.get("previousValue"),
112
- "new_value": obj.get("newValue"),
108
+ "previous_value": PropertyValue.from_dict(obj.get("previousValue")) if obj.get("previousValue") is not None else None,
109
+ "new_value": PropertyValue.from_dict(obj.get("newValue")) if obj.get("newValue") is not None else None,
113
110
  "as_at_basis": obj.get("asAtBasis"),
114
111
  "links": [Link.from_dict(_item) for _item in obj.get("links")] if obj.get("links") is not None else None
115
112
  })
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lusid-sdk
3
- Version: 2.1.137
3
+ Version: 2.1.139
4
4
  Summary: LUSID API
5
5
  Home-page: https://github.com/finbourne/lusid-sdk-python
6
6
  License: MIT
@@ -29,8 +29,8 @@ FINBOURNE Technology
29
29
 
30
30
  This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
31
31
 
32
- - API version: 0.11.6571
33
- - Package version: 2.1.137
32
+ - API version: 0.11.6573
33
+ - Package version: 2.1.139
34
34
  - Build package: org.openapitools.codegen.languages.PythonClientCodegen
35
35
  For more information, please visit [https://www.finbourne.com](https://www.finbourne.com)
36
36
 
@@ -1,4 +1,4 @@
1
- lusid/__init__.py,sha256=rK8ckyZVmub6acO1Fbnmv5hheodAPy-bBIKAMtCkX3s,109478
1
+ lusid/__init__.py,sha256=cp8w4qa3zJJvBTvBX1-3Jp9OPXh2T_0lyyLiruQHDcM,109553
2
2
  lusid/api/__init__.py,sha256=PFpT-ADthWd08-JqKOqQTbVW6cz9wdP_us6bg3aBFfs,5555
3
3
  lusid/api/abor_api.py,sha256=AvgsHuWE7qRSYJhKveBE2htSjHpqqS0VNJrysAfwME0,159655
4
4
  lusid/api/abor_configuration_api.py,sha256=G2bKPtMYOZ2GhUrg-nPJtCa9XIZdZYK7oafcbJWDMP8,64033
@@ -67,13 +67,14 @@ lusid/api/transaction_portfolios_api.py,sha256=3HznPMjDx_ohFwiJN8pii2aS8NMeKu23K
67
67
  lusid/api/translation_api.py,sha256=xTAaKEW96JTDIZBXCjxSguCa7Gz4oVd5jdObUE2egwo,20092
68
68
  lusid/api_client.py,sha256=dF6l9RAsdxdQjf6Qn4ny6LB-QXlJmsscWiozCvyyBFA,30709
69
69
  lusid/api_response.py,sha256=6-gnhty6lu8MMAERt3_kTVD7UxQgWFfcjgpcq6iN5IU,855
70
- lusid/configuration.py,sha256=GOfPTuNtNrKvaRvcwtRnSRdpuXLUVzKph4KPF5dCvmQ,14404
70
+ lusid/configuration.py,sha256=8L_qpNG_W_0wm7a1Ws3MsBrJF1CMIVIAxrnyoL0qDS4,14404
71
71
  lusid/exceptions.py,sha256=HIQwgmQrszLlcVCLaqex8dO0laVuejUyOMz7U2ZWJ6s,5326
72
- lusid/extensions/__init__.py,sha256=DeUuQP7yTcklJH7LT-bw9wQhKEggcs1KwQbPbFcOlhw,560
72
+ lusid/extensions/__init__.py,sha256=L7EF4zKjcq1g2GodEumg1-C9xKs7YrQ0QHGPi8XbpO4,629
73
73
  lusid/extensions/api_client.py,sha256=Ob06urm4Em3MLzgP_geyeeGsPCkU225msW_1kpIeABM,30567
74
74
  lusid/extensions/api_client_factory.py,sha256=qPlqYe8AMzXUZrQPMbO5YJrKWLYy01rWNdNcKZVi1Xg,9772
75
75
  lusid/extensions/api_configuration.py,sha256=LbuhaM-PcrY0a4cZ-ff7GBP8UybSqI5Ys2WQOBcr_8I,8052
76
- lusid/extensions/configuration_loaders.py,sha256=vrbsw3GqZ9ax5uoBPQL6skuA-0szU5ZxmrMb5PK1xsA,6760
76
+ lusid/extensions/configuration_loaders.py,sha256=3BNZ6smLbPEYRiJZyNahtgyD1rtCjzZY1vga4YFUFdg,9224
77
+ lusid/extensions/file_access_token.py,sha256=Qfk_tl2bBh9kpxYhNZ-9XlVuV36udeWT97mazZYI1ns,1469
77
78
  lusid/extensions/proxy_config.py,sha256=UUHQhd8ub-mKVIVbzDbmNQYLLemPX1b209ZcDrCFOWw,2187
78
79
  lusid/extensions/refreshing_token.py,sha256=i5z2-LS8WG_VKWuFX1IM_f4waAr-fAQOzusFv2Vc7NA,11032
79
80
  lusid/extensions/rest.py,sha256=tjVCu-cRrYcjp-ttB975vebPKtBNyBWaeoAdO3QXG2I,12698
@@ -136,7 +137,7 @@ lusid/models/amortisation_rule_set.py,sha256=ExFKfMCGVF2-MYZfT_GrCwgsP1aC8vc5R6H
136
137
  lusid/models/annul_quotes_response.py,sha256=mYZSWeQx2veyirZnrWl2HWLB1nLYxqfLC-kAD87L2Qo,4347
137
138
  lusid/models/annul_single_structured_data_response.py,sha256=8PLdLJ-9anIqCr8JYhYQnfwVvfEEMjY8euqfdvHTNKM,3328
138
139
  lusid/models/annul_structured_data_response.py,sha256=m_PPmlTTJmHWbjwlFVOY4fRS8O1eL2K5ZZYLWyjcXJM,4499
139
- lusid/models/applicable_instrument_event.py,sha256=V8MvRtdrrHN50ptAjsy-ec7KempDyFelxt_DOl7LtVw,4825
140
+ lusid/models/applicable_instrument_event.py,sha256=IEVTLsCzFwhgmLMVgMkxwqYxyR1suEnCBv9ntwdMjQ8,5104
140
141
  lusid/models/asset_class.py,sha256=yurc1IbYS3HCMRBncPFfIl8pBiYnt64MP4tiBYJ8usU,793
141
142
  lusid/models/asset_leg.py,sha256=UyH91gd4MFYNtftvd0S1MvJmbtlKjg-BNJMQH1qSLPI,2435
142
143
  lusid/models/barrier.py,sha256=NP7eTStjcFn5wV3KkKPnwCOjQpmbIp5aMm8rJmpwjmU,2745
@@ -894,7 +895,7 @@ lusid/models/staged_modification_effective_range.py,sha256=G9oChBwQ_358d41tVDab-
894
895
  lusid/models/staged_modification_staging_rule.py,sha256=lFw1OutPCR70LzJIhjiL-a6dcPGXV2e8aVAbhPsh0Qw,3295
895
896
  lusid/models/staged_modifications_entity_hrefs.py,sha256=f0mhz_WUwZmSHhF4xxou76TEXXSlkHYp9BpRfDacL_8,3914
896
897
  lusid/models/staged_modifications_info.py,sha256=z2GkecAm0BLbrCmyBf5n_WzlWP-LPZW-s0io15Z5Spk,2827
897
- lusid/models/staged_modifications_requested_change_interval.py,sha256=ndNGD9mspoIFnjoGbwxaatBUjgPvRoKCh4yyoAv-w7g,5061
898
+ lusid/models/staged_modifications_requested_change_interval.py,sha256=IcTpdybRf8Ojcyd4_TAUkg_4WmbNR9O5PTTYTVX6TEA,5025
898
899
  lusid/models/staging_rule.py,sha256=RxvQoGTR8tShrGw4MLFhaR5L4kxdjeXK8hCGp0kagsk,3560
899
900
  lusid/models/staging_rule_approval_criteria.py,sha256=qmAPg2CfdCQvgSiSLte1n9PAz0fYipc8oDVb2QaMIxk,2687
900
901
  lusid/models/staging_rule_match_criteria.py,sha256=_RxCyvulK3necsQz6LI7YacbSZAktEN5cITthxm9F-w,3561
@@ -1066,6 +1067,6 @@ lusid/models/weighted_instruments.py,sha256=1y_y_vw4-LPsbkQx4FOzWdZc5fJnzhVkf1D3
1066
1067
  lusid/models/yield_curve_data.py,sha256=SbxvdJ4-GWK9kpMdw4Fnxc7_kvIMwgsRsd_31UJn7nw,6330
1067
1068
  lusid/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1068
1069
  lusid/rest.py,sha256=TNUzQ3yLNT2L053EdR7R0vNzQh2J3TlYD1T56Dye0W0,10138
1069
- lusid_sdk-2.1.137.dist-info/METADATA,sha256=zqqwvlkALV3kgPI1HPOd_rRM-Q9K5bBeH6Av6izyFPY,188265
1070
- lusid_sdk-2.1.137.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1071
- lusid_sdk-2.1.137.dist-info/RECORD,,
1070
+ lusid_sdk-2.1.139.dist-info/METADATA,sha256=iB0MS8gEQzUUxid5NjO7akJxr3YO76QAGw2G1hshNjM,188265
1071
+ lusid_sdk-2.1.139.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1072
+ lusid_sdk-2.1.139.dist-info/RECORD,,