fix: small changes #9

Merged
rdenadai merged 1 commit from rdenadai/improvements-v.0.0.2-fix into main 2025-11-14 00:51:47 +00:00
Owner

Rate Limiting Enhancements

  • Added rate limit exceeded exception handler to properly handle rate limit violations
  • Imported RateLimitExceeded exception and _rate_limit_exceeded_handler from slowapi
  • Registered the rate limit exception handler on the Starlette application
  • Attached limiter to application state for proper middleware integration
  • Increased API rate limit from 10 to 25 requests per minute for the /api/card endpoint

Caching Optimization

  • Reduced cache TTL from 600 seconds (10 minutes) to 300 seconds (5 minutes) for card data
  • Ensures more frequent updates of scraped content while maintaining performance benefits

Web Scraper Improvements

  • Added urljoin import from urllib.parse for proper URL handling
  • Improved type hints by adding Any type import and explicit dict[str, Any] annotation for og_data
  • Fixed relative image URL handling: converts relative image paths to absolute URLs using urljoin
  • Ensures proper display of Open Graph images when websites use relative paths instead of absolute URLs
### Rate Limiting Enhancements - Added rate limit exceeded exception handler to properly handle rate limit violations - Imported `RateLimitExceeded` exception and `_rate_limit_exceeded_handler` from slowapi - Registered the rate limit exception handler on the Starlette application - Attached limiter to application state for proper middleware integration - Increased API rate limit from 10 to 25 requests per minute for the `/api/card` endpoint ### Caching Optimization - Reduced cache TTL from 600 seconds (10 minutes) to 300 seconds (5 minutes) for card data - Ensures more frequent updates of scraped content while maintaining performance benefits ### Web Scraper Improvements - Added `urljoin` import from `urllib.parse` for proper URL handling - Improved type hints by adding `Any` type import and explicit `dict[str, Any]` annotation for `og_data` - Fixed relative image URL handling: converts relative image paths to absolute URLs using `urljoin` - Ensures proper display of Open Graph images when websites use relative paths instead of absolute URLs
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rdenadai/api.redecapivara.social!9
No description provided.