The script custom_audience_generator.py corresponds to our How to Build a Custom Audience with PDL Tutorial.
- Download the contents of this folder.
- Install Python 3.6+, requests, and pandas.
- Get a Free PDL License & API Key.
- Set your API key on line 12 of custom_audience_generator.py.
'x-api-key': '**** YOUR API KEY HERE ****'
- Go to the
custom_audience/
folder.$ cd ~/custom_audience
- Run the script. (NOTE: The script uses 25 Company Enrichment and 50 Person Search PDL credits!)
$ python custom_audience_generator.py
For a detailed explanation of this script, please read the tutorial.
The tutorial was written using v19.0 of the PDL API.
In future builds, the companies or people matched may be different than the examples in the tutorial.
The script uses 25 Company Enrichment and 50 Person Search PDL credits.
Each time you run the script, it will use PDL credits. If you save the results of an API call and load them later (instead of making another request to PDL), it will not use credits.
To save the API results, you can export the pandas DataFrame to a CSV and load it in subsequent runs by commenting out the functions like this:
# first run, make the API call (costs PDL credits)
# ----
audience_df = get_decision_makers(companies)
audience_df.to_csv(csv_location / 'custom_audience.csv')
# audience_df = pd.read_csv(
# csv_location / 'custom_audience.csv', header=0, index_col=0)
# future runs, do not make API call (no credits)
# ----
# audience_df = get_decision_makers(companies)
# audience_df.to_csv(csv_location / 'custom_audience.csv')
audience_df = pd.read_csv(
csv_location / 'custom_audience.csv', header=0, index_col=0)