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

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 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!

Image for post

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store