Python Forum
Newbie seeking help with DNS query
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie seeking help with DNS query
#1
I'm fairly new to python, so I'm currently at a loss as to how to proceed...

I need to write a script that will perform a DNS query (simple, not the issue) on a hostname and then compare the results and do "something" if a change is detected (this is the problem).

Specific use case, I have an parter connection to an API endpoint, which is load-balanced and will return 3 IP's. Occasionally, those IP's will change (when the partner updates the API, when it rains, just because) and my connections will fail because I have to add the IP's to an AWS route-table (to specifically route traffic to those IP's through a NAT - don't ask)

I can easily update the route-table (delete the "old" routes, add the new") but I'm struggling at how/where to keep the current IP's and then compare the results of the query to detect if one or more have changed -- and if a change does occur, update the "current" IPs used to compare and then update the route table. The only piece I can't figure out is the IP storage/compare part... Any help appreciated.

dig +short my.api.endpoint
PsERE3uQUNuZ.gaMA7UxUguso.some-aws-region.elb.amazonaws.com
12.3.45.67
1.234.56.7
123.45.67.89
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Seeking advice on dask distributed sawtooth500 4 172 8 hours ago
Last Post: sawtooth500
  New user seeking help EdRaponi 2 42,657 Jun-23-2020, 12:03 PM
Last Post: EdRaponi
  seeking suggestions for function option name Skaperen 1 2,540 Dec-22-2018, 05:27 AM
Last Post: Gribouillis
  Newbie query regarding lists jazmad 5 3,488 Oct-13-2018, 07:58 PM
Last Post: jazmad
  Seeking understanding with the python import function. Intelligent_Agent0 2 2,592 Feb-18-2018, 11:57 PM
Last Post: snippsat
  Seeking feedback on my script-in-progress league55 2 2,637 Feb-12-2018, 03:03 PM
Last Post: league55
  Seeking creative and knowlegeable coder for help! Elusth 4 5,458 Nov-07-2016, 08:26 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020