I'm trying to recive data from an API through ssl (the only allowed method), the dimension of "response" changes as the amount ("n_data") of requested data, so the socket buffer size is increased as the increment of data.
When I decode the response I find that it is incomplete (with bigger "n_data" values), and if I call "len(response)" it always returns max 13680 characters, ignoring missing characters and raising a JSON decode error.
request = json.dumps(request) + "\n"
connection.sendall(request.encode())
n_data = 5000
response = connection.recv(512*n_data).decode()
print(len(response))
response = json.loads(response)
Am I doing something wrong?