poslední změny

This commit is contained in:
2025-10-20 13:49:38 +02:00
parent 561a91d023
commit 89e32b1d28
9 changed files with 40 additions and 76 deletions

View File

@@ -16,9 +16,6 @@ last_api_call = 0.0 # remember when we last called the API
def _throttle_api():
"""
Pause if the last API call was too recent.
This is a super basic rate limiter: we allow one request every 5 seconds.
It helps to not run through your daily quota too fast.
"""
global last_api_call
now = time.time()
@@ -51,8 +48,8 @@ def _cse_request(q, num=DEFAULT_NUM, hl=DEFAULT_LOCALE):
- GOOGLE_DEVELOPER_KEY (your API key)
- GOOGLE_CSE_ID (your search engine ID)
"""
api_key = os.environ.get("GOOGLE_DEVELOPER_KEY")
cse_id = os.environ.get("GOOGLE_CSE_ID")
api_key = (os.environ.get("GOOGLE_DEVELOPER_KEY") or "").strip()
cse_id = (os.environ.get("GOOGLE_CSE_ID") or "").strip()
if not api_key:
raise RuntimeError("GOOGLE_DEVELOPER_KEY není nastaven v .env")
if not cse_id: