kiteconnect.exceptions
exceptions.py
Exceptions raised by the Kite Connect client.
:copyright: (c) 2021 by Zerodha Technology. :license: see LICENSE for details.
1# -*- coding: utf-8 -*- 2""" 3 exceptions.py 4 5 Exceptions raised by the Kite Connect client. 6 7 :copyright: (c) 2021 by Zerodha Technology. 8 :license: see LICENSE for details. 9""" 10 11 12class KiteException(Exception): 13 """ 14 Base exception class representing a Kite client exception. 15 16 Every specific Kite client exception is a subclass of this 17 and exposes two instance variables `.code` (HTTP error code) 18 and `.message` (error text). 19 """ 20 21 def __init__(self, message, code=500): 22 """Initialize the exception.""" 23 super(KiteException, self).__init__(message) 24 self.code = code 25 26 27class GeneralException(KiteException): 28 """An unclassified, general error. Default code is 500.""" 29 30 def __init__(self, message, code=500): 31 """Initialize the exception.""" 32 super(GeneralException, self).__init__(message, code) 33 34 35class TokenException(KiteException): 36 """Represents all token and authentication related errors. Default code is 403.""" 37 38 def __init__(self, message, code=403): 39 """Initialize the exception.""" 40 super(TokenException, self).__init__(message, code) 41 42 43class PermissionException(KiteException): 44 """Represents permission denied exceptions for certain calls. Default code is 403.""" 45 46 def __init__(self, message, code=403): 47 """Initialize the exception.""" 48 super(PermissionException, self).__init__(message, code) 49 50 51class OrderException(KiteException): 52 """Represents all order placement and manipulation errors. Default code is 500.""" 53 54 def __init__(self, message, code=500): 55 """Initialize the exception.""" 56 super(OrderException, self).__init__(message, code) 57 58 59class InputException(KiteException): 60 """Represents user input errors such as missing and invalid parameters. Default code is 400.""" 61 62 def __init__(self, message, code=400): 63 """Initialize the exception.""" 64 super(InputException, self).__init__(message, code) 65 66 67class DataException(KiteException): 68 """Represents a bad response from the backend Order Management System (OMS). Default code is 502.""" 69 70 def __init__(self, message, code=502): 71 """Initialize the exception.""" 72 super(DataException, self).__init__(message, code) 73 74 75class NetworkException(KiteException): 76 """Represents a network issue between Kite and the backend Order Management System (OMS). Default code is 503.""" 77 78 def __init__(self, message, code=503): 79 """Initialize the exception.""" 80 super(NetworkException, self).__init__(message, code)
13class KiteException(Exception): 14 """ 15 Base exception class representing a Kite client exception. 16 17 Every specific Kite client exception is a subclass of this 18 and exposes two instance variables `.code` (HTTP error code) 19 and `.message` (error text). 20 """ 21 22 def __init__(self, message, code=500): 23 """Initialize the exception.""" 24 super(KiteException, self).__init__(message) 25 self.code = code
Base exception class representing a Kite client exception.
Every specific Kite client exception is a subclass of this
and exposes two instance variables .code
(HTTP error code)
and .message
(error text).
22 def __init__(self, message, code=500): 23 """Initialize the exception.""" 24 super(KiteException, self).__init__(message) 25 self.code = code
Initialize the exception.
Inherited Members
- builtins.BaseException
- with_traceback
28class GeneralException(KiteException): 29 """An unclassified, general error. Default code is 500.""" 30 31 def __init__(self, message, code=500): 32 """Initialize the exception.""" 33 super(GeneralException, self).__init__(message, code)
An unclassified, general error. Default code is 500.
31 def __init__(self, message, code=500): 32 """Initialize the exception.""" 33 super(GeneralException, self).__init__(message, code)
Initialize the exception.
Inherited Members
- builtins.BaseException
- with_traceback
36class TokenException(KiteException): 37 """Represents all token and authentication related errors. Default code is 403.""" 38 39 def __init__(self, message, code=403): 40 """Initialize the exception.""" 41 super(TokenException, self).__init__(message, code)
Represents all token and authentication related errors. Default code is 403.
39 def __init__(self, message, code=403): 40 """Initialize the exception.""" 41 super(TokenException, self).__init__(message, code)
Initialize the exception.
Inherited Members
- builtins.BaseException
- with_traceback
44class PermissionException(KiteException): 45 """Represents permission denied exceptions for certain calls. Default code is 403.""" 46 47 def __init__(self, message, code=403): 48 """Initialize the exception.""" 49 super(PermissionException, self).__init__(message, code)
Represents permission denied exceptions for certain calls. Default code is 403.
47 def __init__(self, message, code=403): 48 """Initialize the exception.""" 49 super(PermissionException, self).__init__(message, code)
Initialize the exception.
Inherited Members
- builtins.BaseException
- with_traceback
52class OrderException(KiteException): 53 """Represents all order placement and manipulation errors. Default code is 500.""" 54 55 def __init__(self, message, code=500): 56 """Initialize the exception.""" 57 super(OrderException, self).__init__(message, code)
Represents all order placement and manipulation errors. Default code is 500.
55 def __init__(self, message, code=500): 56 """Initialize the exception.""" 57 super(OrderException, self).__init__(message, code)
Initialize the exception.
Inherited Members
- builtins.BaseException
- with_traceback
60class InputException(KiteException): 61 """Represents user input errors such as missing and invalid parameters. Default code is 400.""" 62 63 def __init__(self, message, code=400): 64 """Initialize the exception.""" 65 super(InputException, self).__init__(message, code)
Represents user input errors such as missing and invalid parameters. Default code is 400.
63 def __init__(self, message, code=400): 64 """Initialize the exception.""" 65 super(InputException, self).__init__(message, code)
Initialize the exception.
Inherited Members
- builtins.BaseException
- with_traceback
68class DataException(KiteException): 69 """Represents a bad response from the backend Order Management System (OMS). Default code is 502.""" 70 71 def __init__(self, message, code=502): 72 """Initialize the exception.""" 73 super(DataException, self).__init__(message, code)
Represents a bad response from the backend Order Management System (OMS). Default code is 502.
71 def __init__(self, message, code=502): 72 """Initialize the exception.""" 73 super(DataException, self).__init__(message, code)
Initialize the exception.
Inherited Members
- builtins.BaseException
- with_traceback
76class NetworkException(KiteException): 77 """Represents a network issue between Kite and the backend Order Management System (OMS). Default code is 503.""" 78 79 def __init__(self, message, code=503): 80 """Initialize the exception.""" 81 super(NetworkException, self).__init__(message, code)
Represents a network issue between Kite and the backend Order Management System (OMS). Default code is 503.
79 def __init__(self, message, code=503): 80 """Initialize the exception.""" 81 super(NetworkException, self).__init__(message, code)
Initialize the exception.
Inherited Members
- builtins.BaseException
- with_traceback