Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: made status page URL configurable and added description about live instance rate limits #97

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ APP_PORT=80
APP_BASE_URL=https://overfast-api.tekrop.fr
LOG_LEVEL=info
MAX_CONCURRENT_REQUESTS=5
STATUS_PAGE_URL=

# Redis
REDIS_CACHING_ENABLED=true
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@


## ✨ [Live instance](https://overfast-api.tekrop.fr)
The live instance is restricted to **30 req/s** (a shared limit across all endpoints). If you require more, consider hosting your own instance on a server 👍

- Live instance (Redoc documentation) : https://overfast-api.tekrop.fr/
- Swagger UI : https://overfast-api.tekrop.fr/docs
Expand Down
3 changes: 3 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class Settings(BaseSettings):
# Max HTTPX concurrent requests for async calls to Blizzard (cache updates)
max_concurrent_requests: int = 5

# Optional, status page URL if you have any to provide
status_page_url: str | None = None

############
# REDIS CONFIGURATION
############
Expand Down
23 changes: 13 additions & 10 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ async def lifespan(_: FastAPI): # pragma: no cover


app = FastAPI(title="OverFast API", docs_url=None, redoc_url=None, lifespan=lifespan)
description = f"""OverFast API gives data about Overwatch 2 heroes, gamemodes, maps and players
statistics by scraping Blizzard pages. Built with **FastAPI** and **Beautiful Soup**, and uses
**nginx** as reverse proxy and **Redis** for caching. By using a Refresh-Ahead cache system, it
minimizes calls to Blizzard pages (which can be very slow), and quickly returns accurate
data to users.
description = f"""OverFast API provides comprehensive data on Overwatch 2 heroes,
game modes, maps, and player statistics by scraping Blizzard pages. Developed with
the efficiency of **FastAPI** and **Beautiful Soup**, it leverages **nginx** as a
reverse proxy and **Redis** for caching. Its tailored caching mechanism significantly
reduces calls to Blizzard pages, ensuring swift and precise data delivery to users.

In players statistics endpoints, several conversions are made for convenience :
- all **duration values** are converted into **seconds** (integer)
- **percent values** are exposed as **integers** instead of a string with a percent symbol
- integer and float string representations are converted into the concerned type
This live instance is restricted to **30 req/s** (a shared limit across all endpoints).
If you require more, consider hosting your own instance on a server 👍

In player career statistics, various conversions are applied for ease of use:
- **Duration values** are converted to **seconds** (integer)
- **Percent values** are represented as **integers**, omitting the percent symbol
- Integer and float string representations are converted to their respective types

Swagger UI (useful for trying API calls) : {settings.app_base_url}/docs

Status page : https://stats.uptimerobot.com/E0k0yU1pJQ
{f"Status page : {settings.status_page_url}" if settings.status_page_url else ""}
"""


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "overfast-api"
version = "2.25.1"
version = "2.25.2"
description = "Overwatch API giving data about heroes, maps, and players statistics."
license = "MIT"
authors = ["Valentin PORCHET <[email protected]>"]
Expand Down
Loading