Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 28 lines (18 sloc) 846 Bytes
#!/usr/bin/python
import json, csv, os, sys
api_key = "<<insert your API key here>>"
#
# Get all of the hemembers and print name and origin_as list
#
#
os.system( 'curl "https://internet2-2.deepfield.net/dimension/hemembers/positions?attributes=(match:origin_as_is,match:peer_as,match:cidrs)&api_key=' + api_key + '" -o current-hemembers.json' )
with open('current-hemembers.json') as data_file:
current_hemembers = json.load(data_file)
for position_id in current_hemembers:
data = current_hemembers[position_id]
origin_as = data['match']['origin_as_is']
peer_as = data['match']['peer_as']
cidrs = data['match']['cidrs']
print "Name: {0:25} Origin AS: {1:35} Peer AS: {2:10} CIDRS: {3}".format(data['name'], " ".join(origin_as), " ".join(peer_as), " ".join(cidrs) )
data_file.close()
os.remove('current-hemembers.json')