swapniljariwala / nsepy

Python Library to get publicly available data on NSE website ie. stock quotes, historical data, live indices
https://nsepy-xyz.web.app
Other
758 stars 377 forks source link

requests.exceptions.TooManyRedirects: Exceeded 30 redirects. #246

Open techpranav opened 1 year ago

techpranav commented 1 year ago

For below code,

from nsepy import get_history from datetime import date df = get_history(symbol="SBIN", start=date(2023,1,1), end=date(2023,1,5))

getting TooManyRedirects exception.

`C:\ProgramData\Anaconda3\envs\NSE-39\python.exe "D:\OneDrive - Technia AB\Learn\DSGS\Development\Python\NSE\Test.py" Traceback (most recent call last): File "D:\OneDrive - Technia AB\Learn\DSGS\Development\Python\NSE\Test.py", line 3, in df = get_history(symbol="SBIN", start=date(2023,1,1), end=date(2023,1,5)) File "C:\Users\prsh01\AppData\Roaming\Python\Python39\site-packages\nsepy\history.py", line 138, in get_history return get_history_quanta(kwargs) File "C:\Users\prsh01\AppData\Roaming\Python\Python39\site-packages\nsepy\history.py", line 143, in get_history_quanta df = url_to_df(url=url, File "C:\Users\prsh01\AppData\Roaming\Python\Python39\site-packages\nsepy\history.py", line 151, in url_to_df resp = url(params) File "C:\Users\prsh01\AppData\Roaming\Python\Python39\site-packages\nsepy\commons.py", line 167, in call return self.session.get(url, params=kwargs, proxies = self.proxy ) File "C:\ProgramData\Anaconda3\envs\NSE-39\lib\site-packages\requests\sessions.py", line 600, in get return self.request("GET", url, kwargs) File "C:\ProgramData\Anaconda3\envs\NSE-39\lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "C:\ProgramData\Anaconda3\envs\NSE-39\lib\site-packages\requests\sessions.py", line 723, in send history = [resp for resp in gen] File "C:\ProgramData\Anaconda3\envs\NSE-39\lib\site-packages\requests\sessions.py", line 723, in history = [resp for resp in gen] File "C:\ProgramData\Anaconda3\envs\NSE-39\lib\site-packages\requests\sessions.py", line 191, in resolve_redirects raise TooManyRedirects( requests.exceptions.TooManyRedirects: Exceeded 30 redirects.

Process finished with exit code 1 `

Paridhicodes commented 1 year ago

@swapniljariwala please look into this on an urgent basis.

Harshaadhithya commented 1 year ago

Yes, facing the same issue. Kindly please look into this asap

alloc7260 commented 1 year ago

Use this insted : NSE-HISTORY-SCRAPER