Open aniu888 opened 2 years ago
Please provide demonstration code and a description of the problem. If english isn't your first language, feel free to write the issue in your first language and I'll put it through a translator on my end.
https://tda-api.readthedocs.io/en/latest/help.html#provide-adequate-information
请提供演示代码和问题描述。如果英语随时不是您的母语,请使用您的母语编写问题,我将通过翻译完成。
https://tda-api.readthedocs.io/en/latest/help.html#provide-adequate-information
OSError Traceback (most recent call last) ~\AppData\Roaming\Python\Python38\site-packages\httpcore_exceptions.py in map_exceptions(map) 7 try: ----> 8 yield 9 except Exception as exc: # noqa: PIE786
~\AppData\Roaming\Python\Python38\site-packages\httpcore\backends\sync.py in start_tls(self, ssl_context, server_hostname, timeout) 56 self.close() ---> 57 raise exc 58 return SyncStream(sock)
~\AppData\Roaming\Python\Python38\site-packages\httpcore\backends\sync.py in start_tls(self, ssl_context, server_hostname, timeout) 51 self._sock.settimeout(timeout) ---> 52 sock = ssl_context.wrap_socket( 53 self._sock, server_hostname=server_hostname
D:\Program Files\anaconda3\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session) 499 # ctx._wrap_socket() --> 500 return self.sslsocket_class._create( 501 sock=sock,
D:\Program Files\anaconda3\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session) 1039 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets") -> 1040 self.do_handshake() 1041 except (OSError, ValueError):
D:\Program Files\anaconda3\lib\ssl.py in do_handshake(self, block) 1308 self.settimeout(None) -> 1309 self._sslobj.do_handshake() 1310 finally:
OSError: [Errno 0] Error
During handling of the above exception, another exception occurred:
ConnectError Traceback (most recent call last) ~\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py in map_httpcore_exceptions() 59 try: ---> 60 yield 61 except Exception as exc: # noqa: PIE-786
~\AppData\Roaming\Python\Python38\site-packages\httpx_transports\default.py in handle_request(self, request) 217 with map_httpcore_exceptions(): --> 218 resp = self._pool.handle_request(req) 219
~\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection_pool.py in handle_request(self, request) 252 self.response_closed(status) --> 253 raise exc 254 else:
~\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection_pool.py in handle_request(self, request) 236 try: --> 237 response = connection.handle_request(request) 238 except ConnectionNotAvailable:
~\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\http_proxy.py in handle_request(self, request) 254 ) --> 255 connect_response = self._connection.handle_request( 256 connect_request
~\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py in handle_request(self, request) 85 self._connect_failed = True ---> 86 raise exc 87 elif not self._connection.is_available():
~\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py in handle_request(self, request) 62 try: ---> 63 stream = self._connect(request) 64
~\AppData\Roaming\Python\Python38\site-packages\httpcore_sync\connection.py in _connect(self, request) 149 with Trace("connection.start_tls", request, kwargs) as trace: --> 150 stream = stream.start_tls(**kwargs) 151 trace.return_value = stream
~\AppData\Roaming\Python\Python38\site-packages\httpcore\backends\sync.py in start_tls(self, ssl_context, server_hostname, timeout) 56 self.close() ---> 57 raise exc 58 return SyncStream(sock)
D:\Program Files\anaconda3\lib\contextlib.py in exit(self, type, value, traceback) 130 try: --> 131 self.gen.throw(type, value, traceback) 132 except StopIteration as exc:
~\AppData\Roaming\Python\Python38\site-packages\httpcore_exceptions.py in map_exceptions(map) 11 if isinstance(exc, from_exc): ---> 12 raise to_exc(exc) 13 raise # pragma: nocover
ConnectError: [Errno 0] Error
The above exception was the direct cause of the following exception:
ConnectError Traceback (most recent call last)
Please provide example code to show how this failure was triggered. It would also help to explain what you were attempting to do when you encountered this failure.
请在发生此故障时如何触发。当您也显示此故障时,这将解释您正在尝试提供的示例。
The above problem occurs when I use my own computer. I can use the server computer normally.
The example is as follows, I have done error handling, so no error is reported, but the quotation result will not be displayed
from tda import auth, client import requests import json
def baojia(symbol): global x2,x3,x4 token_path =r'e:\python\token.pickle' api_key = '****' # api_key is_error = 1 while is_error == 1: try: client = auth.client_from_token_file(token_path, api_key) x1=json.loads(client.get_quotes(symbol).text) is_error = 0 except: print('An error occurred') is_error = 1 x2=x1[symbol]['lastPrice'];print(x1[symbol]) x3=x1[symbol]['markPercentChangeInDouble']; x4=x1[symbol]['totalVolume']; baojia('TYDEV');print(x3);print(x2);print(x4)
Please read the bug submission guidelines before submitting a bug.
Not following guidelines may result in your bug being ignored and/or closed.
Description of Bug