def list_ports(token, public_url):
 headers = {'X-Auth-Token': token}
 auth_url = (public_url + 'v2.0/ports')
 r = requests.get(auth_url, headers=headers)
 if r.text:
  parsed_json = json.loads(r.text)
  return parsed_json['ports']
 else:
  sys.stderr.write('ERROR: Unable to retrieve Neutron ports list\n')
  exit(1)

def list_ports ( token , public_url ) : headers = { 'X-Auth-Token' : token } auth_url = ( public_url + 'v2.0/ports' ) r = requests . get ( auth_url , headers = headers ) if r . text : parsed_json = json . loads ( r . text ) return parsed_json [ 'ports' ] else : sys . stderr . write ( 'ERROR: Unable to retrieve Neutron ports list\n' ) exit ( 1 )
fetches a list of all networks for a tenant cli example: .