title: python fabric get public ip address
body: <p>Try to get public ip address of host with python fabric</p>
  
  <pre><code>def publicip():
          ip = local("curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/\'\1/g\'")
          print (red(ip))
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Fatal error: local() encountered an error (return code 2) while executing 'curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/'/g''
  </code></pre>