Using SRV DNS records with the python requests library
<p>Is it possible to have the Python requests library resolve a consul domain name with a SRV record and utilize the correct IP address and port when making the request?</p>

<p>For example, given that I have serviceA running with the IP address 172.18.0.5 on port 8080 and this service is registered with consul. And given that DNS for the host is set to use consul to resolve queries. Can I make a request like:</p>

<pre><code>requests.get('http://serviceA.service.consul')
</code></pre>

<p>and have it be equivalent to the request:</p>

<pre><code>requests.get('http://172.18.0.5:8080')
</code></pre>

<p>No, you can't unless you rewrite <code>requests</code>.</p>

<p>SRV record is design to find a service.<br>
In this case, you already indicate to use http. So client will only query A or AAAA record for <code>serviceA.service.consul</code>.</p>

python dns python-requests consul