Skip to main content

Python SDK for Lighthouse Private Markets API with PostgREST-style querying

Project description

Lighthouse API Client (Python)

Simple and powerful Python client for interacting with the Lighthouse API. Perfect for managing and analyzing your startup's data.

Features

  • 🚀 Easy to use API
  • 📦 Built on Supabase
  • 💪 Python support
  • ⚡ Lightweight

Installation

Using pip:

pip install lighthouse-client

Quick Start

Importing and Initialization

from lighthouse import Lighthouse

# Initialize the client
lighthouse = Lighthouse('your-api-key')

Fetching Startups

def get_startups():
    try:
        response = lighthouse.client.from_('startups').select('*').limit(10).execute()
        if response.error:
            raise Exception(response.error)
        print("Startups:", response.data)
    except Exception as err:
        print("Error:", err)

get_startups()

Common Query Examples

Select Single Record

# Get a specific startup
response = lighthouse.client.from_('startups').select('*').eq('id', 123).single().execute()

Filter Records

# Get all startups valued over $1M
response = lighthouse.client.from_('startups').select('name, valuation').gte('valuation', 1000000).order('valuation', ascending=False).execute()

Select with Relationships

# Get startups with their founders
response = lighthouse.client.from_('startups').select('name, founders (name, role)').execute()

Pagination

# Get 10 records with offset
response = lighthouse.client.from_('startups').select('*').range(0, 9).execute()

Full Text Search

# Search startups by name
response = lighthouse.client.from_('startups').select('*').text_search('name', 'tech').execute()

API Reference

Initialization Options

lighthouse = Lighthouse('your-api-key', url='https://your-custom-url.com')  # Optional

Available Methods

  • select(): Choose fields to return
  • single(): Return a single record
  • eq(): Equal to
  • neq(): Not equal to
  • gt(): Greater than
  • gte(): Greater than or equal to
  • lt(): Less than
  • lte(): Less than or equal to
  • like(): Pattern matching
  • ilike(): Case insensitive pattern matching
  • in_(): In array
  • order(): Order results
  • limit(): Limit number of records
  • range(): Select range of records

Error Handling

response = lighthouse.client.from_('startups').select('*').execute()
if response.error:
    if response.error.code == 'PGRST116':
        print('Invalid API key')
    elif response.error.code == '42P01':
        print('Table does not exist')
    else:
        print('An error occurred:', response.error)
    exit()

# Process your data
print(response.data)

Best Practices

  1. Always check for errors before using data
  2. Use try/except blocks for error handling
  3. Limit your selections to required fields only
  4. Use pagination for large datasets
  5. Cache results when appropriate

Support

License

MIT License - see the LICENSE file for details.

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

lighthouse_private_markets_sdk-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

File details

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

File metadata

File hashes

Hashes for lighthouse_private_markets_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff525bac433a518a2eeb0ead78b98f4579215c6707ff73633577bf0d93f2de0a
MD5 8cdcfbcb1af9cdc221b092ddb7915593
BLAKE2b-256 31fc9c60febfe181505931bd0952764d49e63d3f9b479348eea313f4cb5052dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lighthouse_private_markets_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c335aefe5d1b7d14ca45ce4851f9c05d4a6e04783da4a9ff57c219f50de39e95
MD5 700a6a5820993e5c6409d6618e6baa09
BLAKE2b-256 3030ae8e786df1517bf7bbe0ac2792f6c33bfc0adde901c372fbe0301b00dc44

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