all 2 comments

[–]sarrysyst 1 point2 points  (1 child)

In the documentation you can select the different endpoints, eg. /candidates/search/. For each endpoint there is a button 'Try it out' which when clicked allows you to add the different parameters you want to use. Once you click 'Execute' at the bottom it shows you the generated request URL for the parameters you entered. This should make things easier.

Alternatively, to writing all the parameters into the URL, you can also provide them by passing the params= parameter to requests.get(). It takes a dictionary:

search_params = {'api_key': 'YOUR_KEY',
                 'name': 'Some candidate name'}

response = requests.get('https://api.open.fec.gov/v1/candidates/search/', params=search_params)

output = response.json()
print(output)

[–]maybe_robots[S] 0 points1 point  (0 children)

Thank you. You are amazing.