Closed jclarkbell closed 3 years ago
First, you have to execute the server3.py file in the terminal and then open a new terminal and run the client3.py file. Note: Don't close the previous terminal where the server3.py file is being executed, if you close that terminal you'll get the above-mentioned error.
Joshua CB@DellInspiron15 MINGW64 ~/Documents/Gitbash/JPMC-tech-task-1-PY3-master $ python client3.py Traceback (most recent call last): File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 1350, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1010, in _send_output self.send(msg) File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 950, in send self.connect() File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 921, in connect self.sock = self._create_connection( File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\socket.py", line 808, in create_connection raise err File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\socket.py", line 796, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "client3.py", line 52, in
quotes = json.loads(urllib.request.urlopen(QUERY.format(random.random())).read())
File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 525, in open
response = self._open(req, data)
File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 542, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 1379, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:\Users\Joshua CB\AppData\Local\Programs\Python\Python38\lib\urllib\request.py", line 1353, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>