How to Enrich an Input Lead with Additional Data Fields in Python

Cloudmersive
2 min readJun 4, 2020

I’m not going to waste your time explaining why input lead enrichment is or why it’s useful. Instead, I’m just going to jump straight to showing you how to accomplish this task in a bare minimum of time. You will be shocked at how easy this can be.

Starting off, we use pip to install our API client files — just use this command here:

pip install cloudmersive-validate-api-client

Next we shall set up our API function call. To do this, instantiate an API object (this will need a key) and then use that object to call said function — in this case lead_enrichment_enrich_lead.

from __future__ import print_functionimport timeimport cloudmersive_validate_api_clientfrom cloudmersive_validate_api_client.rest import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_validate_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_validate_api_client.LeadEnrichmentApi(cloudmersive_validate_api_client.ApiClient(configuration))request = cloudmersive_validate_api_client.LeadEnrichmentRequest() # LeadEnrichmentRequest | Input lead with known fields set, and unknown fields left blank (null)try:# Enrich an input lead with additional fields of dataapi_response = api_instance.lead_enrichment_enrich_lead(request)pprint(api_response)except ApiException as e:print("Exception when calling LeadEnrichmentApi->lead_enrichment_enrich_lead: %s\n" % e)

With that done, you just need to input your request with the relevant fields, etc. That’s it! Talk about easy. Now there’s just the matter of figuring out what to do with all that time you just freed up!

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.