Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requests.exceptions.SSLError caused due to #24

Closed
reachbharathan opened this issue May 3, 2023 · 3 comments
Closed

requests.exceptions.SSLError caused due to #24

reachbharathan opened this issue May 3, 2023 · 3 comments

Comments

@reachbharathan
Copy link

reachbharathan commented May 3, 2023

Hi Team,
I have installed the library via pip3

while executing the below code , I am getting the below error mentioned


from nsepython import *
import ssl

ssl._create_default_https_context = ssl._create_unverified_context
ssl._create_default_https_context = ssl._create_unverified_context
ssl._create_default_https_context = ssl._create_stdlib_context

print(indices)
print(fnolist())
print(nse_optionchain_scrapper('PVR'))

Error Code

MaxRetryError: HTTPSConnectionPool(host='www.nseindia.com', port=443): Max retries exceeded with url: /api/equity-stockIndices?index=SECURITIES%20IN%20F%26O (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))

Complete Error Code

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 419, in connect
    self.sock = ssl_wrap_socket(
                ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 517, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1075, in _create
    self.do_handshake()
  File "/usr/local/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1346, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)

For all python request ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed, I would use verify=False like requests.get('http://api.xxxx.com/v1/sbin',verify=False), but not sure how to pass the SSL verification false for the nsepython library

certificate verify failed: unable to get local issuer certificate

System Configuration:
Mac
Python 3.11.2
pip 23.1.2

@reachbharathan
Copy link
Author

For all python request ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed, I would use verify=False like requests.get('http://api.xxxx.com/v1/sbin',verify=False), but not sure how to pass the SSL verification false for the nsepython library

@reachbharathan
Copy link
Author

There was an intermediate VPN that was causing the issue, closing the issue

@aeron7
Copy link
Owner

aeron7 commented May 13, 2023

Use nsepythonserver. Thats beta release and will be added in the main documentation shortly. Read from https://forum.unofficed.com/t/nsepython-documentation/376/155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants