opkg update
opkg install python-openssl #adds ssl support to python
opkg install distribute #it contains the easy_install command line tool (this can take some time)
easy_install pip #installs pip  (this can take some time)
pip install requests
nano ipinfo.py
#!/usr/bin/python
import json
import requests
def getipinfo():
        result = requests.get('http://ipinfo.io/json/')
        json_result = json.loads(result.text)
        tmpstr=''
        for key, value in json_result.items():
                tmpstr=tmpstr+'"'+value+'",'
        return  tmpstr[:-1]
print getipinfo()
chmod 755 ipinfo.py
./ipinfo.py
"39.0437,-77.4875","Ashburn","US","Virginia","ec2-54-211-19-103.compute-1.amazonaws.com","54.211.19.103","AS14618 Amazon.com, Inc.","20147"

Comments powered by CComment