Forums

Problems connecting to APIs

Hello, I've deployed my application but some of their functions involve API calls, specifically to SportRadar (which I've seen is in the whitelist) and 3 other RapidApi APIs (which I think are also accepted in the whitelist).

So the truth is that I don't know what is the problem, I get this error:

2023-04-15 15:09:11,015: Internal Server Error: /update-ranking/
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/martin974/ATP-Predictor/main/views.py", line 78, in update_players
    updateRanking(players)
  File "/home/martin974/ATP-Predictor/main/auxiliar/createDataset.py", line 123, in updateRanking
    connSportRadar1.request("GET", "/tennis/trial/v3/en/rankings.json?api_key="+api_key)
  File "/usr/local/lib/python3.10/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.10/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.10/http/client.py", line 975, in send
    self.connect()
  File "/usr/local/lib/python3.10/http/client.py", line 1447, in connect
    super().connect()
  File "/usr/local/lib/python3.10/http/client.py", line 941, in connect
    self.sock = self._create_connection(
  File "/usr/local/lib/python3.10/socket.py", line 845, in create_connection
    raise err
  File "/usr/local/lib/python3.10/socket.py", line 833, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Thanks in advance

You may need to configure the proxy.

Thanks!