You can accomplish this by querying the settings via the Device Cloud. The following is an example Exported from the Device Cloud API Explorer found under the Documentation tab. You would fill in the items in bold as necessary. This will return all of the network settings, you would simply parse for the "ip":
# The following lines require manual changes
username = "YourUsername" # enter your username
password = "YourPassword" # enter your password
# This example establishes a https connection, but doesn't provide the server certificate validation.
# Production code should implement certificate validation.
#
import httplib
import base64
# create HTTP basic authentication string, this consists of
# "username:password" base64 encoded
auth = base64.encodestring("%s:%s"%(username,password))[:-1]
# message to send to server
message = """<sci_request version="1.0">
<send_message cache="false">
<targets>
<device id="00000000-00000000-00409DFF-FFXXXXXX"/>
</targets>
<rci_request version="1.1">
<query_setting/>
</rci_request>
</send_message>
</sci_request>
"""
webservice = httplib.HTTPSConnection("login.etherios.com")
# to what URL to send the request with a given HTTP method
webservice.putrequest("POST", "/ws/sci")
# add the authorization string into the HTTP header
webservice.putheader("Authorization", "Basic %s"%auth)
webservice.putheader("Content-type", "text/xml; charset=\"UTF-8\"")
webservice.putheader("Content-length", "%d" % len(message))
webservice.endheaders()
webservice.send(message)
# get the response
response = webservice.getresponse()
statuscode = response.status
statusmessage = response.reason
response_body = response.read()
# print the output to standard out
print (statuscode, statusmessage)
print response_body