Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,8 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 23 |
|
| 24 |
# Rate limiting configuration
|
| 25 |
RATE_LIMIT = 15 # Requests per minute
|
| 26 |
-
TOKEN_BUCKET_CAPACITY
|
|
|
|
| 27 |
TOKEN_BUCKET_REFILL_RATE = RATE_LIMIT / 60.0 # Tokens per second
|
| 28 |
|
| 29 |
# Initialize global token bucket with MemoryStorage
|
|
@@ -45,8 +46,7 @@ async def fetch_questions(session: aiohttp.ClientSession, questions_url: str) ->
|
|
| 45 |
except aiohttp.ClientError as e:
|
| 46 |
print(f"Error fetching questions: {e}")
|
| 47 |
return None
|
| 48 |
-
except
|
| 49 |
-
Exception as e:
|
| 50 |
print(f"An unexpected error occurred fetching questions: {e}")
|
| 51 |
return None
|
| 52 |
|
|
|
|
| 23 |
|
| 24 |
# Rate limiting configuration
|
| 25 |
RATE_LIMIT = 15 # Requests per minute
|
| 26 |
+
TOKEN_BUCKET_CAPACITY
|
| 27 |
+
= RATE_LIMIT
|
| 28 |
TOKEN_BUCKET_REFILL_RATE = RATE_LIMIT / 60.0 # Tokens per second
|
| 29 |
|
| 30 |
# Initialize global token bucket with MemoryStorage
|
|
|
|
| 46 |
except aiohttp.ClientError as e:
|
| 47 |
print(f"Error fetching questions: {e}")
|
| 48 |
return None
|
| 49 |
+
except Exception as e:
|
|
|
|
| 50 |
print(f"An unexpected error occurred fetching questions: {e}")
|
| 51 |
return None
|
| 52 |
|