Skip to main content

Python SDK for easily integrating with the CUFinder API

Project description

CUFinder Python SDK

Python 3.8+ License: MIT PyPI version

Type-safe Python SDK for easily integrating with the CUFinder B2B Data Enrichment API.

Features

  • 🚀 Type-safe: Built with Pydantic for full type safety and validation
  • 🔧 Easy to use: Simple, intuitive API design
  • 🛡️ Robust: Comprehensive error handling and retry logic
  • 📚 Well documented: Extensive documentation and examples
  • 🔄 Async ready: Built for both sync and async usage patterns
  • 🎯 Production ready: Battle-tested in production environments

Installation

pip install cufinder-py

Quick Start

from cufinder import CufinderSDK

# Initialize the SDK
sdk = CufinderSDK(api_key="your-api-key-here")

# Get company domain from company name
company = sdk.cuf(
    company_name="TechCorp",
    country_code="US"
)
print(company.domain)  # 'techcorp.com'

# Enrich LinkedIn profile
profile = sdk.epp(
    linkedin_url="https://linkedin.com/in/johndoe"
)
print(profile.person.full_name)  # 'John Doe'

# Search local businesses
businesses = sdk.lbs(
    name="coffee shop",
    city="San Francisco",
    state="CA"
)
print(f"Found {businesses.total} businesses")

API Services

CUF - Company URL Finder

Find the official website URL of a company based on its name.

domain = sdk.cuf(
    company_name="Microsoft",
    country_code="US"
)

EPP - Email Pattern Predictor

Enrich LinkedIn profiles to get person and company data.

profile = sdk.epp(
    linkedin_url="https://linkedin.com/in/satyanadella"
)

LBS - Local Business Search

Search for local businesses by location, industry, or name.

businesses = sdk.lbs(
    name="restaurant",
    city="New York",
    state="NY",
    industry="food"
)

Configuration

sdk = CufinderSDK(
    api_key="your-api-key",
    base_url="https://api.cufinder.io/v2",  # Optional
    timeout=30,  # Optional, default 30 seconds
    max_retries=3  # Optional, default 3 retries
)

Error Handling

The SDK provides comprehensive error handling with specific exception types:

from cufinder import (
    CufinderError,
    AuthenticationError,
    ValidationError,
    RateLimitError,
    CreditLimitError,
    NetworkError
)

try:
    result = sdk.cuf(company_name="TechCorp", country_code="US")
except ValidationError as e:
    print(f"Validation error: {e}")
except AuthenticationError as e:
    print(f"Authentication failed: {e}")
except RateLimitError as e:
    print(f"Rate limit exceeded. Retry after: {e.retry_after} seconds")
except CreditLimitError as e:
    print(f"Credit limit exceeded: {e}")
except NetworkError as e:
    print(f"Network error: {e}")
except CufinderError as e:
    print(f"API error: {e}")

Advanced Usage

Direct Client Access

For advanced usage, you can access the underlying HTTP client:

client = sdk.get_client()

# Make custom requests
response = client.get("/custom-endpoint", params={"param": "value"})

Custom Headers

response = client.post(
    "/endpoint",
    data={"key": "value"},
    headers={"Custom-Header": "value"}
)

Response Models

All responses are strongly typed using Pydantic models:

from cufinder.models import CufResponse, EppResponse, LbsResponse

# CUF Response
domain: CufResponse = sdk.cuf("TechCorp", "US")
print(domain.domain)
print(domain.confidence)

# EPP Response  
profile: EppResponse = sdk.epp("https://linkedin.com/in/johndoe")
print(profile.person.full_name)
print(profile.company.name)

# LBS Response
businesses: LbsResponse = sdk.lbs(city="San Francisco")
print(businesses.total)
print(businesses.businesses[0]["name"])

Development

Setup

git clone https://github.com/CUFinder/cufinder-py.git
cd cufinder-py
pip install -e ".[dev]"

Running Tests

pytest

Code Formatting

black src/ tests/
isort src/ tests/

Type Checking

mypy src/

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Changelog

See CHANGELOG.md for a detailed history of changes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cufinder_py-0.0.1.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cufinder_py-0.0.1-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file cufinder_py-0.0.1.tar.gz.

File metadata

  • Download URL: cufinder_py-0.0.1.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cufinder_py-0.0.1.tar.gz
Algorithm Hash digest
SHA256 437af6287b0187fe2c394db520b77a0b27e016087add7218676ab6db3abed057
MD5 6123d0839bb8374bfda61cdd4ab36006
BLAKE2b-256 44eb865635f0455151701a95f2bc342b6e5eb8efc59bc6af4e3e4c9b4e6e855a

See more details on using hashes here.

File details

Details for the file cufinder_py-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: cufinder_py-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cufinder_py-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0e4370f09eff406da69f20212315997f30e5cc43a2d7d9eb4a9d15a80a138157
MD5 acabf8ff94e0814559307ac5ced6740d
BLAKE2b-256 a5a69c2dc7b9075f179615f761ec1821c4e3372e41a574859f6e96975ceec8bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page