finatic-server-python 0.1.1__tar.gz → 0.1.3__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.
Files changed (21) hide show
  1. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/PKG-INFO +1 -1
  2. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/pyproject.toml +1 -1
  3. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/__init__.py +2 -0
  4. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/core/api_client.py +9 -1
  5. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/utils/__init__.py +10 -0
  6. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/utils/errors.py +9 -1
  7. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server_python.egg-info/PKG-INFO +1 -1
  8. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/README.md +0 -0
  9. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/setup.cfg +0 -0
  10. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/core/__init__.py +0 -0
  11. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/core/client.py +0 -0
  12. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/types/__init__.py +0 -0
  13. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/types/auth.py +0 -0
  14. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/types/broker.py +0 -0
  15. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/types/common.py +0 -0
  16. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/types/orders.py +0 -0
  17. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server/types/portfolio.py +0 -0
  18. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server_python.egg-info/SOURCES.txt +0 -0
  19. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server_python.egg-info/dependency_links.txt +0 -0
  20. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server_python.egg-info/requires.txt +0 -0
  21. {finatic_server_python-0.1.1 → finatic_server_python-0.1.3}/src/finatic_server_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finatic-server-python
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Python SDK for Finatic Server API
5
5
  Author-email: Finatic <support@finatic.dev>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "finatic-server-python"
7
- version = "0.1.1"
7
+ version = "0.1.3"
8
8
  description = "Python SDK for Finatic Server API"
9
9
  authors = [{ name = "Finatic", email = "support@finatic.dev" }]
10
10
  license = { text = "MIT" }
@@ -65,6 +65,7 @@ from .utils.errors import (
65
65
  OrderError,
66
66
  OrderValidationError,
67
67
  CompanyAccessError,
68
+ TradingNotEnabledError,
68
69
  )
69
70
 
70
71
  __version__ = "0.1.0"
@@ -130,4 +131,5 @@ __all__ = [
130
131
  "OrderError",
131
132
  "OrderValidationError",
132
133
  "CompanyAccessError",
134
+ "TradingNotEnabledError",
133
135
  ]
@@ -48,6 +48,7 @@ from ..utils.errors import (
48
48
  OrderError,
49
49
  OrderValidationError,
50
50
  CompanyAccessError,
51
+ TradingNotEnabledError,
51
52
  )
52
53
 
53
54
  T = TypeVar('T')
@@ -268,7 +269,14 @@ class ApiClient:
268
269
  if status == 401:
269
270
  raise AuthenticationError(message)
270
271
  elif status == 403:
271
- raise AuthorizationError(message)
272
+ # Check for specific 403 error codes
273
+ error_code = error_data.get("code") or error_data.get("detail", {}).get("code")
274
+ if error_code == "TRADING_NOT_ENABLED":
275
+ raise TradingNotEnabledError(message, error_data)
276
+ elif error_code == "NO_COMPANY_ACCESS":
277
+ raise CompanyAccessError(message, error_data)
278
+ else:
279
+ raise AuthorizationError(message)
272
280
  elif status == 422:
273
281
  raise ValidationError(message)
274
282
  elif status == 429:
@@ -6,6 +6,11 @@ from .errors import (
6
6
  AuthenticationError,
7
7
  ValidationError,
8
8
  RateLimitError,
9
+ AuthorizationError,
10
+ OrderError,
11
+ OrderValidationError,
12
+ CompanyAccessError,
13
+ TradingNotEnabledError,
9
14
  )
10
15
 
11
16
  __all__ = [
@@ -14,4 +19,9 @@ __all__ = [
14
19
  "AuthenticationError",
15
20
  "ValidationError",
16
21
  "RateLimitError",
22
+ "AuthorizationError",
23
+ "OrderError",
24
+ "OrderValidationError",
25
+ "CompanyAccessError",
26
+ "TradingNotEnabledError",
17
27
  ]
@@ -83,4 +83,12 @@ class CompanyAccessError(ApiError):
83
83
 
84
84
  def __init__(self, message: str, response_data: Optional[Dict[str, Any]] = None):
85
85
  super().__init__(message, 403, response_data)
86
- self.code = "COMPANY_ACCESS_ERROR"
86
+ self.code = "COMPANY_ACCESS_ERROR"
87
+
88
+
89
+ class TradingNotEnabledError(ApiError):
90
+ """Raised when trading is not enabled for the company."""
91
+
92
+ def __init__(self, message: str, response_data: Optional[Dict[str, Any]] = None):
93
+ super().__init__(message, 403, response_data)
94
+ self.code = "TRADING_NOT_ENABLED"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: finatic-server-python
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Python SDK for Finatic Server API
5
5
  Author-email: Finatic <support@finatic.dev>
6
6
  License: MIT