Skip to main content

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

Project description

Datafiniti SDK

PyPI version

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.1.tar.gz (7.4 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.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datafiniti_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 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.1.tar.gz
Algorithm Hash digest
SHA256 d2e8905470e5a739b240cd552c0f2f3836ebc05f00742bd72ff4c08774c5737f
MD5 136cca0082e1c55632e113cf2b114d73
BLAKE2b-256 d2a660a083a6ef764a7f55e35fe32440dac25064e30d377ad23e6783d6cc791e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datafiniti_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46c4ff7283e15369ea72c064861d31acffd79e228668c2faebd441c333470cc3
MD5 c4bbb39ecd053584fe3515148eb3a886
BLAKE2b-256 5fea3036c8f94df39f3349eb64738bc21671c94962d77d4c4f91d80e606b37aa

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