Ultimate-NodeJs-Resources
Ultimate-NodeJs-Resources copied to clipboard
Is it not available in jupyterlite?
Hello, thank you for providing a good library. When I tried to load data from Jupyterite, the following message appeared.
The error message is:
---------------------------------------------------------------------------
SSLError Traceback (most recent call last)
File /lib/python3.10/site-packages/urllib3/connectionpool.py:692, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
691 timeout_obj = self._get_timeout(timeout)
--> 692 conn = self._get_conn(timeout=pool_timeout)
694 conn.timeout = timeout_obj.connect_timeout
File /lib/python3.10/site-packages/urllib3/connectionpool.py:281, in HTTPConnectionPool._get_conn(self, timeout)
279 conn = None
--> 281 return conn or self._new_conn()
File /lib/python3.10/site-packages/urllib3/connectionpool.py:1011, in HTTPSConnectionPool._new_conn(self)
1010 if not self.ConnectionCls or self.ConnectionCls is DummyConnection:
-> 1011 raise SSLError(
1012 "Can't connect to HTTPS URL because the SSL module is not available."
1013 )
1015 actual_host = self.host
SSLError: Can't connect to HTTPS URL because the SSL module is not available.
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
File /lib/python3.10/site-packages/requests/adapters.py:489, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
488 if not chunked:
--> 489 resp = conn.urlopen(
490 method=request.method,
491 url=url,
492 body=request.body,
493 headers=request.headers,
494 redirect=False,
495 assert_same_host=False,
496 preload_content=False,
497 decode_content=False,
498 retries=self.max_retries,
499 timeout=timeout,
500 )
502 # Send the request.
503 else:
File /lib/python3.10/site-packages/urllib3/connectionpool.py:787, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
785 e = ProtocolError("Connection aborted.", e)
--> 787 retries = retries.increment(
788 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
789 )
790 retries.sleep()
File /lib/python3.10/site-packages/urllib3/util/retry.py:592, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
591 if new_retry.is_exhausted():
--> 592 raise MaxRetryError(_pool, url, error or ResponseError(cause))
594 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
MaxRetryError: HTTPSConnectionPool(host='fchart.stock.naver.com', port=443): Max retries exceeded with url: /sise.nhn?timeframe=day&count=6000&requestType=0&symbol=005930 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
Cell In[23], line 4
2 end_date = '20201231'
3 sample_code = '005930'
----> 4 stock = fdr.DataReader(sample_code, start = start_date, end = end_date)
5 stock
File /lib/python3.10/site-packages/FinanceDataReader/data.py:48, in DataReader(symbol, start, end, exchange, data_source)
45 # KRX and Naver Finance
46 if (symbol[:5].isdigit() and exchange==None) or \
47 (symbol[:5].isdigit() and exchange and exchange.upper() == 'KRX'):
---> 48 return NaverDailyReader(symbol, start, end).read()
50 # KRX-DELISTING
51 if (symbol[:5].isdigit() and exchange and exchange.upper() in ['KRX-DELISTING']):
File /lib/python3.10/site-packages/FinanceDataReader/naver/data.py:34, in NaverDailyReader.read(self)
31 def read(self):
32 # single symbol
33 if ',' not in self.symbol:
---> 34 return _naver_data_reader(self.symbol, self.start, self.end)
36 # multiple symbols, merge close price data as columns
37 sym_list = [s.strip() for s in self.symbol.split(',') if s]
File /lib/python3.10/site-packages/FinanceDataReader/naver/data.py:9, in _naver_data_reader(symbol, start, end)
7 def _naver_data_reader(symbol, start, end):
8 url = 'https://fchart.stock.naver.com/sise.nhn?timeframe=day&count=6000&requestType=0&symbol='
----> 9 r = requests.get(url + symbol)
11 data_list = re.findall('<item data=\"(.*?)\" />', r.text, re.DOTALL)
12 if len(data_list) == 0:
File /lib/python3.10/site-packages/requests/api.py:73, in get(url, params, **kwargs)
62 def get(url, params=None, **kwargs):
63 r"""Sends a GET request.
64
65 :param url: URL for the new :class:`Request` object.
(...)
70 :rtype: requests.Response
71 """
---> 73 return request("get", url, params=params, **kwargs)
File /lib/python3.10/site-packages/requests/api.py:59, in request(method, url, **kwargs)
55 # By using the 'with' statement we are sure the session is closed, thus we
56 # avoid leaving sockets open which can trigger a ResourceWarning in some
57 # cases, and look like a memory leak in others.
58 with sessions.Session() as session:
---> 59 return session.request(method=method, url=url, **kwargs)
File /lib/python3.10/site-packages/requests/sessions.py:587, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
582 send_kwargs = {
583 "timeout": timeout,
584 "allow_redirects": allow_redirects,
585 }
586 send_kwargs.update(settings)
--> 587 resp = self.send(prep, **send_kwargs)
589 return resp
File /lib/python3.10/site-packages/requests/sessions.py:701, in Session.send(self, request, **kwargs)
698 start = preferred_clock()
700 # Send the request
--> 701 r = adapter.send(request, **kwargs)
703 # Total elapsed time of the request (approximately)
704 elapsed = preferred_clock() - start
File /lib/python3.10/site-packages/requests/adapters.py:563, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
559 raise ProxyError(e, request=request)
561 if isinstance(e.reason, _SSLError):
562 # This branch is for urllib3 v1.22 and later.
--> 563 raise SSLError(e, request=request)
565 raise ConnectionError(e, request=request)
567 except ClosedPoolError as e:
SSLError: HTTPSConnectionPool(host='fchart.stock.naver.com', port=443): Max retries exceeded with url: /sise.nhn?timeframe=day&count=6000&requestType=0&symbol=005930 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
Thank you for reading.
the following may be helpful
https://www.interviewsvector.com/module-pexpect-has-no-attribute/
Thank you for answering.
Sorry for the confusion by editing my question. In the jupyterlite environment, the above ssl error occurred. How should I solve it?
Here's how I've tried:
-
[Why do I keep getting SSL: CERTIFICATE_VERIFY_FAILED] error when using API's?](https://stackoverflow.com/questions/73385267/why-do-i-keep-getting-ssl-certificate-verify-failed-error-when-using-apis) I tried, but DataReader() got an unexpected keyword argument 'session'
-
https://www.inflearn.com/questions/380807/1-1-%EA%B0%95-financedatareader-%EC%84%A4%EC%B9%98-%EC%98%A4%EB%A5%98 I applied the above and performed the following, but I got an error with Parse error at "'--truste'". import piplite await piplite.install('finance-datareader --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org')
import ssl ssl._create_default_https_context = ssl._create_unverified_context
Not resolved.
Thank you for reading.