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 returnsingle(): Return a single recordeq(): Equal toneq(): Not equal togt(): Greater thangte(): Greater than or equal tolt(): Less thanlte(): Less than or equal tolike(): Pattern matchingilike(): Case insensitive pattern matchingin_(): In arrayorder(): Order resultslimit(): Limit number of recordsrange(): 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
- Always check for errors before using data
- Use try/except blocks for error handling
- Limit your selections to required fields only
- Use pagination for large datasets
- Cache results when appropriate
Support
- 📧 Email: hello@trylighthouse.vc
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lighthouse_private_markets_sdk-0.1.0.tar.gz.
File metadata
- Download URL: lighthouse_private_markets_sdk-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff525bac433a518a2eeb0ead78b98f4579215c6707ff73633577bf0d93f2de0a
|
|
| MD5 |
8cdcfbcb1af9cdc221b092ddb7915593
|
|
| BLAKE2b-256 |
31fc9c60febfe181505931bd0952764d49e63d3f9b479348eea313f4cb5052dc
|
File details
Details for the file lighthouse_private_markets_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lighthouse_private_markets_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c335aefe5d1b7d14ca45ce4851f9c05d4a6e04783da4a9ff57c219f50de39e95
|
|
| MD5 |
700a6a5820993e5c6409d6618e6baa09
|
|
| BLAKE2b-256 |
3030ae8e786df1517bf7bbe0ac2792f6c33bfc0adde901c372fbe0301b00dc44
|