Skip to main content

Python SDK for Datafiniti Data APIs (Business, People, Property, Product)

Project description

Datafiniti SDK

Python SDK for the Datafiniti Data APIs — Business, People, Property, and Product data.

Installation

pip install datafiniti-sdk

Authentication

All SDK classes require a Datafiniti API key. You can pass it directly or set it as an environment variable:

export DATAFINITI_API_KEY="your_api_key_here"

Quick Start

from datafiniti import DatafinitiBusinessSDK, DatafinitiPeopleSDK, PropertyDataSDK, DatafinitiProductSDK

# Initialize from environment variable
sdk = PropertyDataSDK.from_env()

# Or pass the key directly
sdk = PropertyDataSDK(api_key="your_api_key_here")

Business Data

from datafiniti import DatafinitiBusinessSDK

sdk = DatafinitiBusinessSDK.from_env()

# Search by name
results = sdk.search_by_name("Starbucks", city="Seattle", num_records=5)

# Count matching records
count = sdk.count('name:"Starbucks" AND country:US')

# Build a custom query
query = sdk.query().country("US").build()
results = sdk.search(query, num_records=10)

# Paginate through large result sets
for record in sdk.paginate('name:"Starbucks"', page_size=100, max_records=500):
    print(record)

People Data

from datafiniti import DatafinitiPeopleSDK

sdk = DatafinitiPeopleSDK.from_env()

# Search by name
results = sdk.search_by_name("John Smith", city="Austin", num_records=10)

# Count matching records
count = sdk.count('name:"John Smith" AND country:US')

Property Data

from datafiniti import PropertyDataSDK

sdk = PropertyDataSDK.from_env()

# Search by address
results = sdk.search_by_address("123 Main St", postal_code="78701", num_records=1)

# Find properties for sale
results = sdk.for_sale(
    postal_codes=["78701", "78702"],
    property_types=["Single Family Residential"],
    num_records=20
)

# Count matching records
count = sdk.count('country:US AND mostRecentStatus:"For Sale"')

# Paginate through results
for record in sdk.paginate('country:US AND mostRecentStatus:"For Sale"', page_size=100):
    print(record["address"])

Product Data

from datafiniti import DatafinitiProductSDK

sdk = DatafinitiProductSDK.from_env()

# Search by product name
results = sdk.search_by_name("iPhone 15", brand="Apple", num_records=10)

# Count matching records
count = sdk.count('brand:"Apple"')

Common Methods

All four SDK classes inherit these methods:

Method Description
search(query, num_records) Search and return up to num_records results
count(query) Return the total number of matching records
paginate(query, page_size, max_records) Generator that yields records page by page
query() Returns a query builder for the data type

Error Handling

from datafiniti import DatafinitiAPIError

try:
    results = sdk.search("country:US", num_records=10)
except DatafinitiAPIError as e:
    print(f"API error {e.status_code}: {e.message}")

Requirements

  • Python 3.9+
  • requests >= 2.31.0

License

MIT

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

datafiniti_sdk-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

datafiniti_sdk-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file datafiniti_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: datafiniti_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.10

File hashes

Hashes for datafiniti_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a9ffe3dcad916fe909c4389ac285e6320964201f3db2759fd813ff82e32c2a8e
MD5 6c9769b44f4bcdb97b73b83083a3dac6
BLAKE2b-256 7c182ee3d969216ca35460a3c0b1938cc54e7d31f47432888295e6fb2413aed1

See more details on using hashes here.

File details

Details for the file datafiniti_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: datafiniti_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.10

File hashes

Hashes for datafiniti_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20f756c4b42ecfb3ed20cb42ee7b1b884ea3162fc8a66481a69642474615997d
MD5 e8a6aa012e11b62dfef0f7a0a6c79263
BLAKE2b-256 b9f3f48647653d25b0915dceda8246967d05278cc2282fc66a58b6cb15b899a3

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