nsepython 2.94__py3-none-any.whl → 2.95__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.
- nsepython/rahu.py +33 -21
- {nsepython-2.94.dist-info → nsepython-2.95.dist-info}/METADATA +14 -2
- nsepython-2.95.dist-info/RECORD +7 -0
- {nsepython-2.94.dist-info → nsepython-2.95.dist-info}/WHEEL +1 -1
- nsepython-2.94.dist-info/RECORD +0 -7
- {nsepython-2.94.dist-info → nsepython-2.95.dist-info/licenses}/LICENSE +0 -0
- {nsepython-2.94.dist-info → nsepython-2.95.dist-info}/top_level.txt +0 -0
nsepython/rahu.py
CHANGED
|
@@ -13,32 +13,44 @@ import urllib.parse
|
|
|
13
13
|
|
|
14
14
|
mode ='local'
|
|
15
15
|
|
|
16
|
-
if
|
|
17
|
-
def nsefetch(payload):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
if mode == "vpn":
|
|
17
|
+
def nsefetch(payload: str):
|
|
18
|
+
def encode(url: str) -> str:
|
|
19
|
+
if "%26" in url or "%20" in url:
|
|
20
|
+
return url
|
|
21
|
+
return urllib.parse.quote(url, safe=":/?&=")
|
|
22
|
+
|
|
23
|
+
def refresh_cookies():
|
|
24
|
+
os.popen(f'curl -c cookies.txt "https://www.nseindia.com" {curl_headers}').read()
|
|
25
|
+
os.popen(f'curl -b cookies.txt -c cookies.txt "https://www.nseindia.com/option-chain" {curl_headers}').read()
|
|
26
|
+
|
|
27
|
+
if not os.path.exists("cookies.txt"):
|
|
28
|
+
refresh_cookies()
|
|
29
|
+
|
|
30
|
+
encoded_url = encode(payload)
|
|
31
|
+
cmd = f'curl -b cookies.txt "{encoded_url}" {curl_headers}'
|
|
32
|
+
raw = os.popen(cmd).read()
|
|
33
|
+
|
|
23
34
|
try:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
return json.loads(raw)
|
|
36
|
+
except ValueError:
|
|
37
|
+
refresh_cookies()
|
|
38
|
+
raw = os.popen(cmd).read()
|
|
39
|
+
try:
|
|
40
|
+
return json.loads(raw)
|
|
41
|
+
except ValueError:
|
|
42
|
+
return {}
|
|
43
|
+
|
|
33
44
|
if(mode=='local'):
|
|
34
45
|
def nsefetch(payload):
|
|
46
|
+
|
|
35
47
|
try:
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
s = requests.Session()
|
|
49
|
+
s.get("https://www.nseindia.com", headers=headers, timeout=10)
|
|
50
|
+
s.get("https://www.nseindia.com/option-chain", headers=headers, timeout=10)
|
|
51
|
+
output = s.get(payload, headers=headers, timeout=10).json()
|
|
38
52
|
except ValueError:
|
|
39
|
-
|
|
40
|
-
output = s.get("http://nseindia.com",headers=headers)
|
|
41
|
-
output = s.get(payload,headers=headers).json()
|
|
53
|
+
output = {}
|
|
42
54
|
return output
|
|
43
55
|
|
|
44
56
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: nsepython
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.95
|
|
4
4
|
Summary: Python library for NSE India APIs
|
|
5
5
|
Home-page: https://github.com/aeron7/nsepython
|
|
6
6
|
Author: Aeron7
|
|
7
7
|
Author-email: dexter@unofficed.com
|
|
8
|
+
License: GNU
|
|
8
9
|
Keywords: nseindia,nse,python,sdk,trading,stock markets
|
|
9
10
|
Classifier: Intended Audience :: Developers
|
|
10
11
|
Classifier: Natural Language :: English
|
|
@@ -18,6 +19,17 @@ License-File: LICENSE
|
|
|
18
19
|
Requires-Dist: requests
|
|
19
20
|
Requires-Dist: pandas
|
|
20
21
|
Requires-Dist: scipy
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: keywords
|
|
29
|
+
Dynamic: license
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: summary
|
|
21
33
|
|
|
22
34
|
<p align="left">
|
|
23
35
|
<a href="https://aeron7.github.io/nsepython/" target="_blank">
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
nsepython/__init__.py,sha256=smfUB46cZCC2tmcFMU6ry12PpWjKB4enB4Y5nNk_xBo,44
|
|
2
|
+
nsepython/rahu.py,sha256=Pmnn1V7MfExNofSBXKyW6--IV_BQW1p6lOKUdzvyCSc,43471
|
|
3
|
+
nsepython-2.95.dist-info/licenses/LICENSE,sha256=7GKIR95QHGxZUfY_N5Or2XXBVRkLkyTRnZ_cLFyFw8s,35176
|
|
4
|
+
nsepython-2.95.dist-info/METADATA,sha256=X3YgG9vORoXFIngebQOa_WwRo7ndJ0449ARlRVRLF7M,7674
|
|
5
|
+
nsepython-2.95.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
6
|
+
nsepython-2.95.dist-info/top_level.txt,sha256=-hTS08c-pS4rPpiuzLkamRsgHTq7t6BG0M5wnU-iPy4,10
|
|
7
|
+
nsepython-2.95.dist-info/RECORD,,
|
nsepython-2.94.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
nsepython/__init__.py,sha256=smfUB46cZCC2tmcFMU6ry12PpWjKB4enB4Y5nNk_xBo,44
|
|
2
|
-
nsepython/rahu.py,sha256=9RyVOJf9mvYcwTDetvT0hbOMBKnGsH1SQEoXW6XEUNQ,43208
|
|
3
|
-
nsepython-2.94.dist-info/LICENSE,sha256=7GKIR95QHGxZUfY_N5Or2XXBVRkLkyTRnZ_cLFyFw8s,35176
|
|
4
|
-
nsepython-2.94.dist-info/METADATA,sha256=vSl6h9a-R-XTUTDMTFw-Kxcv39kK8d9rOVhFBmZ4nYw,7420
|
|
5
|
-
nsepython-2.94.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
6
|
-
nsepython-2.94.dist-info/top_level.txt,sha256=-hTS08c-pS4rPpiuzLkamRsgHTq7t6BG0M5wnU-iPy4,10
|
|
7
|
-
nsepython-2.94.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|