Skip to content

Instantly share code, notes, and snippets.

@freedomwarrior
Created August 30, 2018 07:49
Show Gist options
  • Select an option

  • Save freedomwarrior/94d44abcee71643e4923e8e452c163bf to your computer and use it in GitHub Desktop.

Select an option

Save freedomwarrior/94d44abcee71643e4923e8e452c163bf to your computer and use it in GitHub Desktop.
device import from us
import json
import urllib.request
patr = '10.'
with urllib.request.urlopen(
"API-URL.WITH.API.KEY") as url:
data = json.loads(url.read().decode())
count = 0
for key, value in data.items():
for key1, value1 in value.items():
if key1 == 'ip':
if patr in value['ip']:
count +=1
print(value['ip'])
print(f'{count} devices.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment