There are 2 primary ways to pass parameters in an API request (when using Python):

  1. Setting parameters through a parameters JSON object
  2. Setting the parameters directly in the URL of the API request

We recommend that users pass parameters via a parameters JSON object, though parameters may also be passed in the URL if desired. Anything found in a JSON object will take precedence over parameters found in the URL. Here is an example of our Person Enrichment API for reference.

URL

import requests

API_KEY = # YOUR API KEY

pdl_url = "https://api.peopledatalabs.com/v5/person/enrich?api_key=%s&[email protected]&company=Hallspot&company=People Data Labs" % API_KEY

json_response = requests.get(pdl_url).json()

###

JSON Object

import requests

API_KEY = # YOUR API KEY

pdl_url = "https://api.peopledatalabs.com/v5/person/enrich"

params = {
    "api_key": API_KEY,
    "company": ["Hallspot", "People Data Labs"],
    "email": ["[email protected]"]
}

json_response = requests.get(pdl_url,  params=params).json()

###

Did this page help you?