-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetnew.py
57 lines (54 loc) · 1.78 KB
/
getnew.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/python
import urllib
import urllib2
import json
#import urllib.parse
#from urlparse import urlparse
import json
import requests
import urlparse
#getVars = {'17.0.142.104/31'}
#ip='17.0.142.104/31'
ip =['17.0.142.100/31', '17.0.142.104/31', '17.0.142.206/31', '17.0.142.82/31']
for ip in ip:1
#print ip
#url = 'https://groot-api.apple.com'
parsed = urlparse.urlparse("https://groot-api.apple.com")
#headers = { 'GNSD-APP-ID': '181','GNSD-APP-KEY': 'subnet-tagging-raja-api-key-123'}
#urlparse.urlparse(url)
#getvars='/api/v1/network/%s.' % ip
#print getvars
#url = parsed._replace(path="%s" %getvars)
urls = parsed._replace(path="/api/v1/network/%s." %ip)
print urls
#for url in urls:
#r = requests.get(url, { 'GNSD-APP-ID': '181','GNSD-APP-KEY': 'subnet-tagging-raja-api-key-123'});
#content = resp.content
#data = r.json()
#print data
#headers = { 'GNSD-APP-ID': '181','GNSD-APP-KEY': 'subnet-tagging-raja-api-key-123'}
#Create the Request.
#request = urllib2.Request(url, None, headers)
#response = urllib2.urlopen(request)
#json_obj = response.read()
#data1 = json.loads(json_obj)
#print data1
#r = requests.get('url')
#data = r.json()
#print data
#attribute= data1["attributes"]
#print attribute["Security-Zone"]
#params = {"ipsubnet" : "17.0.142.104/31" }
#r=requests.get(url, data=params)
#data = r.json()
#print data
#import urllib.parse
#getVars = {'ipsubnet': '17.0.142.104/31'}
#print(url + urllib.parse.urlencode(getVars)
#print(url + urlparse(getVars))
#filter = """
#{17.0.142.104/31}"""
#url = 'https://groot-api.apple.com/api/v1/network/'
#headers = { 'GNSD-APP-ID': '181','GNSD-APP-KEY': 'subnet-tagging-raja-api-key-123'}
#response = requests.get(url=url, params=filter,)
#data = json.load(response)