Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ip in json
#1
I have a json
It is necessary to display on the screen in format domains with 144 in 3 octet
un1> domain
un2> domain
This code displays a list of domains with addresses
import urllib.request
import urllib.parse
import json

doc = urllib.request.urlopen("https://api.antizapret.info/diff.php?dateStart=2014-03-25&dateCurrent=2014-03-30&type=json")
data = doc.read()
encoding = doc.info().get_content_charset('utf-8')
i = json.loads(data.decode(encoding))
n = i.get("recordsAdded")
o = len (n)

for m in range(o):
    ip  = i.get("recordsAdded")[m].get ("ip")
    dom  = i.get("recordsAdded")[m].get ("domain")
    print (ip, ">", dom)
Any ideas ?
Reply


Messages In This Thread
Ip in json - by beren43 - Oct-20-2017, 07:13 PM
RE: Ip in json - by nilamo - Oct-20-2017, 07:27 PM
RE: Ip in json - by beren43 - Oct-20-2017, 07:37 PM
RE: Ip in json - by nilamo - Oct-23-2017, 08:13 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020