Sending a POST request using httplib results in error only when run from gateway event script

Im working with an Ignition server that was just set up by another org, so I dont have all the details regarding how the gateway or server is set up. The code below runs flawlessly from the script console, but results in the following error when run from a gateway event script:

[Errno 8] nodename nor servname provided, or not known

	import httplib
	from base64 import b64encode

	url_path = "example/url/path/"
    BASE_URL = "example.url.com"
	conn = httplib.HTTPSConnection(BASE_URL)
	payload = "<xml>"
	headers = {
		'Authorization': auth_header,
		'Content-Type': 'application/xml'
	}
    # Error occurs on the below line v
	conn.request("POST", url_path, body=payload, headers=headers)
    res = conn.getresponse()

I looked up the error and saw responses saying that the /etc/host file needs to be modified? I dont see why this would apply. Any ideas?

The full stack trace can be found below. send_req is the function which contains the above code.

com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 5,
in File "", line 216, in send_req_power_data
File "", line 155, in send_req
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\httplib.py", line 1042, in request self._send_request(method, url, body, headers)
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\httplib.py", line 1082, in _send_request self.endheaders(body)
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\httplib.py", line 1038, in endheaders self._send_output(message_body)
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\httplib.py", line 882, in _send_output self.send(msg)
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\httplib.py", line 844, in send self.connect()
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\httplib.py", line 1255, in connect HTTPConnection.connect(self)
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\httplib.py", line 820, in connect self.sock = self._create_connection((self.host,self.port),
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib_socket.py", line 1556, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib_socket.py", line 382, in handle_exception return method_or_function(*args, **kwargs)
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib_socket.py", line 382, in handle_exception return method_or_function(*args, **kwargs)
File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib_socket.py", line 1770, in getaddrinfo raise gaierror(errno.ENOEXEC, 'nodename nor servname provided, or not known') _socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Running from the Script Console of the Designer is going to be using DNS lookups from your computer. Running in the gateway scope is going to be dependent on the DNS configuration of the computer running the gateway. So if DNS is not configured (or appropriate entries in the C:\Windows\system32\drivers\etc\hosts file (in this case on Windows) it may not be able to resolve the target name appropriately.