Created
August 30, 2018 07:49
-
-
Save freedomwarrior/94d44abcee71643e4923e8e452c163bf to your computer and use it in GitHub Desktop.
device import from us
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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