Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def cmd_ls_ips(ags):
"""
List IPs used by the agent.
"""
l = []
for name in [Domain.MAIN, Domain.API, Domain.DATA, Domain.PULL]:
for info in socket.getaddrinfo(name, None, 0, 0, socket.IPPROTO_TCP):
ip = info[4][0]
print >>sys.stderr, '%-16s %s' % (ip, name)
l.append(ip)
print l
print ' '.join(l)
def pull_request(what, params):
"""
Processes a pull request on the logentries domain.
"""
response = None
# Obtain response
addr = '/%s/%s/?%s' % (
config.user_key, urllib.quote(what), urllib.urlencode(params))
response, conn = get_response("GET", addr, domain=Domain.PULL)
# Check the response
if not response:
die("Error: Cannot process LE request, no response")
if response.status == 404:
die("Error: Log not found")
if response.status != 200:
die("Error: Cannot process LE request: (%s)" % response.status)
while True:
data = response.read(65536)
if len(data) == 0:
break
sys.stdout.write(data)
conn.close()