fix highspot

This commit is contained in:
Weves 2025-05-01 13:46:17 -07:00 committed by Chris Weaver
parent 0497bfdf78
commit 75fa10cead
2 changed files with 8 additions and 7 deletions

View File

@ -193,12 +193,9 @@ class HighspotClient:
"""
params = {"right": "view"}
response = self._make_request("GET", "spots", params=params)
logger.info(f"Received {response} spots")
total_counts = response.get("counts_total")
# Fix comparison to handle None value
if total_counts is not None and total_counts > 0:
return response.get("collection", [])
return []
found_spots = response.get("collection", [])
logger.info(f"Received {len(found_spots)} spots")
return found_spots
def get_spot(self, spot_id: str) -> Dict[str, Any]:
"""

View File

@ -1,3 +1,4 @@
import os
from datetime import datetime
from io import BytesIO
from typing import Any
@ -447,7 +448,10 @@ class HighspotConnector(LoadConnector, PollConnector, SlimConnector):
if __name__ == "__main__":
spot_names: List[str] = []
connector = HighspotConnector(spot_names)
credentials = {"highspot_key": "", "highspot_secret": ""}
credentials = {
"highspot_key": os.environ.get("HIGHSPOT_KEY"),
"highspot_secret": os.environ.get("HIGHSPOT_SECRET"),
}
connector.load_credentials(credentials=credentials)
for doc in connector.load_from_state():
print(doc)