vortex-api 2.1.5__tar.gz → 2.1.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vortex_api
3
- Version: 2.1.5
3
+ Version: 2.1.7
4
4
  Summary: Vortex APIs to place orders in Rupeezy application
5
5
  Author-email: "Astha Credit & Securities Pvt Ltd." <tech@rupeezy.in>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vortex_api"
7
- version = "2.1.5"
7
+ version = "2.1.7"
8
8
  description = "Vortex APIs to place orders in Rupeezy application"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -0,0 +1 @@
1
+ __version__ = "2.1.7"
@@ -111,27 +111,31 @@ class Constants:
111
111
  def validate_inputs(func):
112
112
  @wrapt.decorator
113
113
  def wrapper(wrapped, instance, args, kwargs):
114
- # Get the function signature
115
114
  sig = inspect.signature(wrapped)
116
- # Validate the input arguments
117
- for param_name, param in sig.parameters.items():
118
- if param_name == 'self':
119
- continue
115
+ # Build ordered list of non-self params for positional index mapping.
116
+ # wrapt strips 'self' from args, so index 0 in args = first non-self param.
117
+ params = [(name, p) for name, p in sig.parameters.items() if name != 'self']
118
+
119
+ for idx, (param_name, param) in enumerate(params):
120
120
  param_type = param.annotation
121
121
  if param_type is inspect.Parameter.empty:
122
122
  continue
123
- if param_type is not inspect.Parameter.empty:
124
- if kwargs.get(param_name) != None:
125
- value = kwargs.get(param_name)
126
- else:
127
- value = args[list(sig.parameters.values()).index(param)]
128
- # value = args[list(sig.parameters.values()).index(param)] if param.kind == inspect.Parameter.POSITIONAL_ONLY else kwargs.get(param_name)
129
- if isinstance(param_type, Enum) and value not in param_type.__members__.values():
130
- raise ValueError(f'{param.name} must be one of {list(param_type.__members__.values())}')
131
- if not isinstance(value, param_type):
132
- raise TypeError(f'{param_name} must be of type {param_type.__name__}')
133
- sig.parameters.values()
134
- # Call the wrapped function
123
+
124
+ # Resolve value: check kwargs first, then positional args
125
+ if param_name in kwargs:
126
+ value = kwargs[param_name]
127
+ elif idx < len(args):
128
+ value = args[idx]
129
+ elif param.default is not inspect.Parameter.empty:
130
+ continue # has a default, skip validation
131
+ else:
132
+ raise TypeError(f"missing required argument: '{param_name}'")
133
+
134
+ if isinstance(param_type, Enum) and value not in param_type.__members__.values():
135
+ raise ValueError(f'{param_name} must be one of {list(param_type.__members__.values())}')
136
+ if not isinstance(value, param_type):
137
+ raise TypeError(f'{param_name} must be of type {param_type.__name__}')
138
+
135
139
  return wrapped(*args, **kwargs)
136
140
 
137
141
  return wrapper(func)
@@ -216,7 +220,16 @@ class VortexAPI:
216
220
  response = requests.request(method, url, headers=headers, json=data,params=params)
217
221
  if self.enable_logging:
218
222
  logging.debug(f"Response received from {url} , body: {response.json()}")
219
- response.raise_for_status()
223
+ if not response.ok:
224
+ try:
225
+ error_body = response.json()
226
+ error_message = error_body.get("message", response.text)
227
+ except Exception:
228
+ error_message = response.text
229
+ raise requests.exceptions.HTTPError(
230
+ f"{response.status_code} {response.reason}: {error_message}",
231
+ response=response,
232
+ )
220
233
  return response.json()
221
234
 
222
235
  def _make_unauth_request(self, method: str, endpoint: str, data: dict = None, params: dict = None) -> dict:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vortex_api
3
- Version: 2.1.5
3
+ Version: 2.1.7
4
4
  Summary: Vortex APIs to place orders in Rupeezy application
5
5
  Author-email: "Astha Credit & Securities Pvt Ltd." <tech@rupeezy.in>
6
6
  License: MIT
@@ -1 +0,0 @@
1
- __version__ = "2.1.5"
File without changes
File without changes
File without changes