Spaces:
Sleeping
Sleeping
Workaround for HF Spaces proxy issue with manual Supabase client creation
Browse files- index_interface_supabase.py +20 -7
- requirements.txt +1 -0
index_interface_supabase.py
CHANGED
|
@@ -7,7 +7,9 @@ from time import sleep
|
|
| 7 |
from functools import partial
|
| 8 |
import argparse
|
| 9 |
import os
|
| 10 |
-
from supabase import
|
|
|
|
|
|
|
| 11 |
from datetime import datetime
|
| 12 |
import hashlib
|
| 13 |
import json
|
|
@@ -24,13 +26,24 @@ print(f"Supabase Key: {supabase_key[:20]}..." if supabase_key else "No Supabase
|
|
| 24 |
|
| 25 |
try:
|
| 26 |
if supabase_url and supabase_key:
|
| 27 |
-
#
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
supabase =
|
| 34 |
|
| 35 |
# Test the connection
|
| 36 |
test_response = supabase.table('index_cache').select('id').limit(1).execute()
|
|
|
|
| 7 |
from functools import partial
|
| 8 |
import argparse
|
| 9 |
import os
|
| 10 |
+
from supabase import Client
|
| 11 |
+
from supabase.client import ClientOptions
|
| 12 |
+
import httpx
|
| 13 |
from datetime import datetime
|
| 14 |
import hashlib
|
| 15 |
import json
|
|
|
|
| 26 |
|
| 27 |
try:
|
| 28 |
if supabase_url and supabase_key:
|
| 29 |
+
# Create client manually to avoid proxy issues in HF Spaces
|
| 30 |
+
options = ClientOptions(
|
| 31 |
+
headers={
|
| 32 |
+
"apikey": supabase_key,
|
| 33 |
+
"Authorization": f"Bearer {supabase_key}"
|
| 34 |
+
},
|
| 35 |
+
schema="public",
|
| 36 |
+
auto_refresh_token=True,
|
| 37 |
+
persist_session=True,
|
| 38 |
+
storage_options={},
|
| 39 |
+
realtime_options={}
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
# Create HTTP client without proxy
|
| 43 |
+
http_client = httpx.Client()
|
| 44 |
|
| 45 |
+
# Initialize Supabase client
|
| 46 |
+
supabase = Client(supabase_url, supabase_key, options)
|
| 47 |
|
| 48 |
# Test the connection
|
| 49 |
test_response = supabase.table('index_cache').select('id').limit(1).execute()
|
requirements.txt
CHANGED
|
@@ -7,6 +7,7 @@ polygon-api-client==1.13.6
|
|
| 7 |
|
| 8 |
# Supabase integration - let pip resolve versions
|
| 9 |
supabase
|
|
|
|
| 10 |
|
| 11 |
# Optional but recommended
|
| 12 |
python-dotenv==1.0.0
|
|
|
|
| 7 |
|
| 8 |
# Supabase integration - let pip resolve versions
|
| 9 |
supabase
|
| 10 |
+
httpx
|
| 11 |
|
| 12 |
# Optional but recommended
|
| 13 |
python-dotenv==1.0.0
|