I have a function that makes a request to a node.js server to get data from the database. Everything works in PyCharm, the server responds to requests and the error does not occur. After building the application with the flet publish main command.py an error is issued:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='185.146.157.133', port=3000): Max retries exceeded with url: /query (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1c39c38>: Failed to establish a new connection: [Errno 50] Protocol not available'))
What to do?
def api_postgres(query):
server_url = "http://123.456.789.012:3000/query"
request_data = {'query': query}
response = requests.post(server_url, json=request_data)
if response.status_code == 200:
result = response.json()
return result
else:
return False