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-private-markets-sdk

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.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.from_('startups').select('*').eq('id', 123).single().execute()

Filter Records

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

Select with Relationships

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

Pagination

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

Full Text Search

# Search startups by name
response = lighthouse.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.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.1.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.1.tar.gz.

File metadata

File hashes

Hashes for lighthouse_private_markets_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d32cec96e59ecd2eb2915a84d76c3188e5ac14ab473698ef3af8b5bbeba5a56b
MD5 8ccc4aca5f549d7a982537e3761ad10c
BLAKE2b-256 9de74798c7042b3bc243ccc3d3e4d247ad654d5f8f897c7b3433ddb3ca1d2da5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lighthouse_private_markets_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e0f7a6b5f61f33ff49add8591f84e8c8b141cd0670a122290196dd11b7623cd
MD5 48e0dfc069ddfcff7d4764a19caf0df1
BLAKE2b-256 9f5336a971372e67b50ad5bfdc104f12a70bb32b69de2656bea7450005f6e3a8

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