Getting my IP using python
<p>I am trying to update my rackspace dns with my IP using a python script.</p>

<p>My script works when I manually enter an IP in it, but dosen't when I get it from the outside, why?</p>

<p>This <strong>WORKS:</strong></p>

<pre><code>#!/usr/bin/env python
import clouddns
import requests
r= requests.get(r'http://curlmyip.com/')
ip= '4.4.4.4'
dns = clouddns.connection.Connection('******','********************')

domain = dns.get_domain(name='reazem.net')
record = domain.get_record(name='ssh.reazem.net')
record.update(data=ip, ttl=600)
</code></pre>

<p>This <strong>DOESN'T:</strong></p>

<pre><code>#!/usr/bin/env python
import clouddns
import requests
r= requests.get(r'http://curlmyip.com/')
**ip= '{}'.format(r.text)**
dns = clouddns.connection.Connection('******','********************')

domain = dns.get_domain(name='reazem.net')
record = domain.get_record(name='ssh.reazem.net')
record.update(data=ip, ttl=600)
</code></pre>

<p>Note: <code>print '{}'.format(r.text)</code> succesfully outputs my ip.</p>

<p>Helping you helping me: I just noticed that <code>print '{}'.format(r.text)</code> adds an extra line, how do I avoid that?</p>

<p>For those interested: <a href="https://github.com/rackspace/python-clouddns" rel="nofollow">https://github.com/rackspace/python-clouddns</a></p>
