poslední změny
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user