import requests
def api_call(endpoint, parameters):
    try:
        call = requests.get(endpoint, params=parameters)
        response = call.json()
    except:
        response = None
    return response
#https://en.wikipedia.org/w/api.php?action=parse&prop=sections&format=json&formatversion=2&page=Whidbey_Island
ENDPOINT = 'https://en.wikipedia.org/w/api.php'

params = {'action' : 'parse',
            'prop' : 'sections',
            'format' : 'json',
            'formatversion' : 2,
            'page' : 'Whidbey_Island',
            }

whidbey_secs = api_call(ENDPOINT, params)
whidbey_secs
{'parse': {'pageid': 33431,
  'sections': [{'anchor': 'History',
    'byteoffset': 4545,
    'fromtitle': 'Whidbey_Island',
    'index': '1',
    'level': '2',
    'line': 'History',
    'number': '1',
    'toclevel': 1},
   {'anchor': 'Government',
    'byteoffset': 7635,
    'fromtitle': 'Whidbey_Island',
    'index': '2',
    'level': '2',
    'line': 'Government',
    'number': '2',
    'toclevel': 1},
   {'anchor': 'Economy',
    'byteoffset': 8512,
    'fromtitle': 'Whidbey_Island',
    'index': '3',
    'level': '2',
    'line': 'Economy',
    'number': '3',
    'toclevel': 1},
   {'anchor': 'Geography',
    'byteoffset': 10801,
    'fromtitle': 'Whidbey_Island',
    'index': '4',
    'level': '2',
    'line': 'Geography',
    'number': '4',
    'toclevel': 1},
   {'anchor': 'Parks_and_reserve_areas',
    'byteoffset': 11780,
    'fromtitle': 'Whidbey_Island',
    'index': '5',
    'level': '2',
    'line': 'Parks and reserve areas',
    'number': '5',
    'toclevel': 1},
   {'anchor': 'Festivals',
    'byteoffset': 13140,
    'fromtitle': 'Whidbey_Island',
    'index': '6',
    'level': '2',
    'line': 'Festivals',
    'number': '6',
    'toclevel': 1},
   {'anchor': 'Climate',
    'byteoffset': 15630,
    'fromtitle': 'Whidbey_Island',
    'index': '7',
    'level': '2',
    'line': 'Climate',
    'number': '7',
    'toclevel': 1},
   {'anchor': 'Ecology',
    'byteoffset': 18783,
    'fromtitle': 'Whidbey_Island',
    'index': '8',
    'level': '2',
    'line': 'Ecology',
    'number': '8',
    'toclevel': 1},
   {'anchor': 'Flora',
    'byteoffset': 18796,
    'fromtitle': 'Whidbey_Island',
    'index': '9',
    'level': '3',
    'line': 'Flora',
    'number': '8.1',
    'toclevel': 2},
   {'anchor': 'Fauna',
    'byteoffset': 20310,
    'fromtitle': 'Whidbey_Island',
    'index': '10',
    'level': '3',
    'line': 'Fauna',
    'number': '8.2',
    'toclevel': 2},
   {'anchor': 'Education',
    'byteoffset': 20976,
    'fromtitle': 'Whidbey_Island',
    'index': '11',
    'level': '2',
    'line': 'Education',
    'number': '9',
    'toclevel': 1},
   {'anchor': 'Public_school_districts',
    'byteoffset': 20993,
    'fromtitle': 'Whidbey_Island',
    'index': '12',
    'level': '3',
    'line': 'Public school districts',
    'number': '9.1',
    'toclevel': 2},
   {'anchor': 'Colleges',
    'byteoffset': 22271,
    'fromtitle': 'Whidbey_Island',
    'index': '13',
    'level': '3',
    'line': 'Colleges',
    'number': '9.2',
    'toclevel': 2},
   {'anchor': 'Notable_people',
    'byteoffset': 22592,
    'fromtitle': 'Whidbey_Island',
    'index': '14',
    'level': '2',
    'line': 'Notable people',
    'number': '10',
    'toclevel': 1},
   {'anchor': 'Politicians',
    'byteoffset': 22612,
    'fromtitle': 'Whidbey_Island',
    'index': '15',
    'level': '3',
    'line': 'Politicians',
    'number': '10.1',
    'toclevel': 2},
   {'anchor': 'Writers_and_artists',
    'byteoffset': 23049,
    'fromtitle': 'Whidbey_Island',
    'index': '16',
    'level': '3',
    'line': 'Writers and artists',
    'number': '10.2',
    'toclevel': 2},
   {'anchor': 'Other',
    'byteoffset': 23712,
    'fromtitle': 'Whidbey_Island',
    'index': '17',
    'level': '3',
    'line': 'Other',
    'number': '10.3',
    'toclevel': 2},
   {'anchor': 'Infrastructure',
    'byteoffset': 24210,
    'fromtitle': 'Whidbey_Island',
    'index': '18',
    'level': '2',
    'line': 'Infrastructure',
    'number': '11',
    'toclevel': 1},
   {'anchor': 'Transportation',
    'byteoffset': 24230,
    'fromtitle': 'Whidbey_Island',
    'index': '19',
    'level': '3',
    'line': 'Transportation',
    'number': '11.1',
    'toclevel': 2},
   {'anchor': 'Health_systems',
    'byteoffset': 26973,
    'fromtitle': 'Whidbey_Island',
    'index': '20',
    'level': '3',
    'line': 'Health systems',
    'number': '11.2',
    'toclevel': 2},
   {'anchor': 'Communities',
    'byteoffset': 27280,
    'fromtitle': 'Whidbey_Island',
    'index': '21',
    'level': '2',
    'line': 'Communities',
    'number': '12',
    'toclevel': 1},
   {'anchor': 'See_also',
    'byteoffset': 27919,
    'fromtitle': 'Whidbey_Island',
    'index': '22',
    'level': '2',
    'line': 'See also',
    'number': '13',
    'toclevel': 1},
   {'anchor': 'References',
    'byteoffset': 27999,
    'fromtitle': 'Whidbey_Island',
    'index': '23',
    'level': '2',
    'line': 'References',
    'number': '14',
    'toclevel': 1},
   {'anchor': 'External_links',
    'byteoffset': 28032,
    'fromtitle': 'Whidbey_Island',
    'index': '24',
    'level': '2',
    'line': 'External links',
    'number': '15',
    'toclevel': 1}],
  'title': 'Whidbey Island'}}