kitecli 0.2.2__tar.gz → 0.2.4__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 (30) hide show
  1. {kitecli-0.2.2 → kitecli-0.2.4}/PKG-INFO +9 -3
  2. {kitecli-0.2.2 → kitecli-0.2.4}/README.md +8 -0
  3. {kitecli-0.2.2 → kitecli-0.2.4}/cli/api_client.py +1 -1
  4. {kitecli-0.2.2 → kitecli-0.2.4}/cli/kite_manager.py +27 -4
  5. {kitecli-0.2.2 → kitecli-0.2.4}/cli/kotak_manager.py +1 -1
  6. {kitecli-0.2.2 → kitecli-0.2.4}/cli/live_session.py +3 -4
  7. {kitecli-0.2.2 → kitecli-0.2.4}/kitecli.egg-info/PKG-INFO +9 -3
  8. {kitecli-0.2.2 → kitecli-0.2.4}/kitecli.egg-info/requires.txt +0 -3
  9. {kitecli-0.2.2 → kitecli-0.2.4}/pyproject.toml +1 -4
  10. {kitecli-0.2.2 → kitecli-0.2.4}/cli/__init__.py +0 -0
  11. {kitecli-0.2.2 → kitecli-0.2.4}/cli/advisor.py +0 -0
  12. {kitecli-0.2.2 → kitecli-0.2.4}/cli/base_manager.py +0 -0
  13. {kitecli-0.2.2 → kitecli-0.2.4}/cli/config.py +0 -0
  14. {kitecli-0.2.2 → kitecli-0.2.4}/cli/display.py +0 -0
  15. {kitecli-0.2.2 → kitecli-0.2.4}/cli/executor.py +0 -0
  16. {kitecli-0.2.2 → kitecli-0.2.4}/cli/main.py +0 -0
  17. {kitecli-0.2.2 → kitecli-0.2.4}/cli/nli.py +0 -0
  18. {kitecli-0.2.2 → kitecli-0.2.4}/cli/parser.py +0 -0
  19. {kitecli-0.2.2 → kitecli-0.2.4}/cli/recorder.py +0 -0
  20. {kitecli-0.2.2 → kitecli-0.2.4}/cli/telegram_bot.py +0 -0
  21. {kitecli-0.2.2 → kitecli-0.2.4}/kitecli.egg-info/SOURCES.txt +0 -0
  22. {kitecli-0.2.2 → kitecli-0.2.4}/kitecli.egg-info/dependency_links.txt +0 -0
  23. {kitecli-0.2.2 → kitecli-0.2.4}/kitecli.egg-info/entry_points.txt +0 -0
  24. {kitecli-0.2.2 → kitecli-0.2.4}/kitecli.egg-info/top_level.txt +0 -0
  25. {kitecli-0.2.2 → kitecli-0.2.4}/setup.cfg +0 -0
  26. {kitecli-0.2.2 → kitecli-0.2.4}/tests/test_multi_broker.py +0 -0
  27. {kitecli-0.2.2 → kitecli-0.2.4}/tests/test_nli.py +0 -0
  28. {kitecli-0.2.2 → kitecli-0.2.4}/tests/test_parser.py +0 -0
  29. {kitecli-0.2.2 → kitecli-0.2.4}/tests/test_telegram.py +0 -0
  30. {kitecli-0.2.2 → kitecli-0.2.4}/tests/test_ui.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kitecli
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: KiteCLI — Multi-account, multi-broker trading positions viewer (Zerodha + Kotak Neo)
5
5
  Author: KiteCLI Team
6
6
  License: MIT
@@ -20,8 +20,6 @@ Requires-Dist: uvicorn[standard]>=0.27.0; extra == "server"
20
20
  Requires-Dist: pydantic>=2.0.0; extra == "server"
21
21
  Provides-Extra: bot
22
22
  Requires-Dist: python-telegram-bot>=20.0; extra == "bot"
23
- Provides-Extra: kotak
24
- Requires-Dist: neo-api-client>=1.0.0; extra == "kotak"
25
23
  Provides-Extra: dev
26
24
  Requires-Dist: pytest>=8.0.0; extra == "dev"
27
25
  Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
@@ -70,6 +68,14 @@ Install the package via `pip`:
70
68
  pip install kitecli
71
69
  ```
72
70
 
71
+ ### Kotak Neo Support (Optional)
72
+
73
+ Since the official Kotak Neo Python SDK is not hosted on PyPI, if you want to use Kotak accounts, you must install the SDK directly from Kotak's official GitHub repository first:
74
+
75
+ ```bash
76
+ pip install "git+https://github.com/Kotak-Neo/Kotak-neo-api-v2.git@v2.0.2#egg=neo_api_client"
77
+ ```
78
+
73
79
  *(For local development or installing from source)*:
74
80
  ```bash
75
81
  git clone https://github.com/chandu389/kitecli.git
@@ -41,6 +41,14 @@ Install the package via `pip`:
41
41
  pip install kitecli
42
42
  ```
43
43
 
44
+ ### Kotak Neo Support (Optional)
45
+
46
+ Since the official Kotak Neo Python SDK is not hosted on PyPI, if you want to use Kotak accounts, you must install the SDK directly from Kotak's official GitHub repository first:
47
+
48
+ ```bash
49
+ pip install "git+https://github.com/Kotak-Neo/Kotak-neo-api-v2.git@v2.0.2#egg=neo_api_client"
50
+ ```
51
+
44
52
  *(For local development or installing from source)*:
45
53
  ```bash
46
54
  git clone https://github.com/chandu389/kitecli.git
@@ -32,7 +32,7 @@ def _get_kotak_manager():
32
32
  except ImportError as exc:
33
33
  raise ImportError(
34
34
  "Kotak Neo support requires the 'neo-api-client' package. "
35
- "Install it with: pip install neo-api-client"
35
+ "Install it with: pip install \"git+https://github.com/Kotak-Neo/Kotak-neo-api-v2.git@v2.0.2#egg=neo_api_client\""
36
36
  ) from exc
37
37
  return _kotak_manager
38
38
 
@@ -111,6 +111,30 @@ class KiteAccountManager(BaseBrokerManager):
111
111
  self._authenticated[api_key] = False
112
112
  self._proxies[api_key] = proxies or {}
113
113
 
114
+ # Monkeypatch reqsession.request to bypass proxy for all non-order endpoints
115
+ orig_request = kite.reqsession.request
116
+ def proxied_request(method, url, *args, **kwargs):
117
+ method_upper = method.upper()
118
+ url_lower = url.lower()
119
+ # Only apply proxies for order placement, modification, or cancellation
120
+ is_order_api = (
121
+ method_upper in ("POST", "PUT", "DELETE") and
122
+ ("/orders" in url_lower or "/gtt" in url_lower)
123
+ )
124
+ if not is_order_api:
125
+ # Remove proxies for both the individual request kwargs and session-level config
126
+ kwargs["proxies"] = {}
127
+ orig_proxies = kite.reqsession.proxies
128
+ kite.reqsession.proxies = {}
129
+ try:
130
+ return orig_request(method, url, *args, **kwargs)
131
+ finally:
132
+ kite.reqsession.proxies = orig_proxies
133
+ else:
134
+ return orig_request(method, url, *args, **kwargs)
135
+
136
+ kite.reqsession.request = proxied_request
137
+
114
138
  sessions = _load_sessions()
115
139
  saved_token = sessions.get(api_key)
116
140
  if saved_token:
@@ -378,10 +402,9 @@ class KiteAccountManager(BaseBrokerManager):
378
402
  session.mount("https://", adapter)
379
403
  session.mount("http://", adapter)
380
404
 
381
- account_proxies = self._proxies.get(api_key, {})
382
- if account_proxies:
383
- session.proxies.update(account_proxies)
384
- logger.info("auto_login: using proxy for %s (api_key=%s…)", user_id, api_key[:8])
405
+ # Zerodha login does not enforce whitelisting, direct is faster and more reliable
406
+ # session.proxies.update(account_proxies)
407
+ # logger.info("auto_login: using proxy for %s (api_key=%s…)", user_id, api_key[:8])
385
408
 
386
409
  try:
387
410
  # Step 1: Login with user_id + password
@@ -227,7 +227,7 @@ class KotakAccountManager(BaseBrokerManager):
227
227
  except ImportError as exc:
228
228
  raise ImportError(
229
229
  "Kotak Neo support requires the 'neo-api-client' package. "
230
- "Install it with: pip install neo-api-client"
230
+ "Install it with: pip install \"git+https://github.com/Kotak-Neo/Kotak-neo-api-v2.git@v2.0.2#egg=neo_api_client\""
231
231
  ) from exc
232
232
 
233
233
  client = NeoAPI(environment="prod", consumer_key=consumer_key)
@@ -1061,9 +1061,8 @@ class KCLILiveSession:
1061
1061
  logs.append(f"[#ff8700]⚠ No token:[/#] @{name} — login required (run 'kcli init').")
1062
1062
  return api_key, "no_token", name, "no access token", acct, logs, True
1063
1063
 
1064
- proxy_str = acct.get("proxy")
1065
1064
  ws_status, ws_detail = await self._run_api_call(
1066
- probe_ws_auth, api_key, access_token, proxy_str
1065
+ probe_ws_auth, api_key, access_token, None
1067
1066
  )
1068
1067
 
1069
1068
  if ws_status == "ok":
@@ -1229,10 +1228,10 @@ class KCLILiveSession:
1229
1228
  ticker.on_close = self._make_on_close(api_key)
1230
1229
  ticker.on_error = self._make_on_error(api_key)
1231
1230
 
1232
- # Parse proxy if configured for this account
1231
+ # Parse proxy if configured for this account (Zerodha WS does not require IP whitelisting, direct is faster)
1233
1232
  proxy_str = acct.get("proxy")
1234
1233
  proxy_dict = None
1235
- if proxy_str:
1234
+ if broker != "zerodha" and proxy_str:
1236
1235
  from urllib.parse import urlparse
1237
1236
  try:
1238
1237
  p_str = proxy_str if "://" in proxy_str else f"http://{proxy_str}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kitecli
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: KiteCLI — Multi-account, multi-broker trading positions viewer (Zerodha + Kotak Neo)
5
5
  Author: KiteCLI Team
6
6
  License: MIT
@@ -20,8 +20,6 @@ Requires-Dist: uvicorn[standard]>=0.27.0; extra == "server"
20
20
  Requires-Dist: pydantic>=2.0.0; extra == "server"
21
21
  Provides-Extra: bot
22
22
  Requires-Dist: python-telegram-bot>=20.0; extra == "bot"
23
- Provides-Extra: kotak
24
- Requires-Dist: neo-api-client>=1.0.0; extra == "kotak"
25
23
  Provides-Extra: dev
26
24
  Requires-Dist: pytest>=8.0.0; extra == "dev"
27
25
  Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
@@ -70,6 +68,14 @@ Install the package via `pip`:
70
68
  pip install kitecli
71
69
  ```
72
70
 
71
+ ### Kotak Neo Support (Optional)
72
+
73
+ Since the official Kotak Neo Python SDK is not hosted on PyPI, if you want to use Kotak accounts, you must install the SDK directly from Kotak's official GitHub repository first:
74
+
75
+ ```bash
76
+ pip install "git+https://github.com/Kotak-Neo/Kotak-neo-api-v2.git@v2.0.2#egg=neo_api_client"
77
+ ```
78
+
73
79
  *(For local development or installing from source)*:
74
80
  ```bash
75
81
  git clone https://github.com/chandu389/kitecli.git
@@ -15,9 +15,6 @@ pytest>=8.0.0
15
15
  pytest-asyncio>=0.23.0
16
16
  httpx>=0.27.0
17
17
 
18
- [kotak]
19
- neo-api-client>=1.0.0
20
-
21
18
  [server]
22
19
  fastapi>=0.110.0
23
20
  uvicorn[standard]>=0.27.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "kitecli"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  description = "KiteCLI — Multi-account, multi-broker trading positions viewer (Zerodha + Kotak Neo)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -36,9 +36,6 @@ server = [
36
36
  bot = [
37
37
  "python-telegram-bot>=20.0",
38
38
  ]
39
- kotak = [
40
- "neo-api-client>=1.0.0",
41
- ]
42
39
  dev = [
43
40
  "pytest>=8.0.0",
44
41
  "pytest-asyncio>=0.23.0",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes