-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/add-mi-malloc
- Loading branch information
Showing
10 changed files
with
137 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "robyn" | ||
version = "0.38.0" | ||
version = "0.39.0" | ||
authors = ["Sanskar Jethi <[email protected]>"] | ||
edition = "2018" | ||
description = "A web server that is fast!" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
## Plugin Design | ||
|
||
Robyn is an extensible web framework that allows anyone to make plugins over the top of Robyn. | ||
Robyn is a versatile and extensible web framework that allows anyone to make plugins over the top of Robyn. | ||
Plugins in Robyn allow you to enhance and customize the framework's functionality to suit your specific needs. Here are some noteworthy plugins that can supercharge your Robyn-based projects: | ||
|
||
### Tutorial coming soon.. | ||
### Rate Limit Plugin | ||
- Description: This plugin enables you to implement rate limiting for your Robyn application's routes. It helps prevent abuse, and brute-force attacks and ensures fair usage of your resources. | ||
- GitHub repository: [robyn-rate-limits](https://github.com/IdoKendo/robyn_rate_limits) | ||
- Installation: | ||
`python -m pip install robyn-rate-limits` | ||
- Usage: | ||
```py | ||
from robyn import Robyn | ||
from robyn_rate_limits import InMemoryStore | ||
from robyn_rate_limits import RateLimiter | ||
|
||
app = Robyn(__file__) | ||
limiter = RateLimiter(store=InMemoryStore, calls_limit=3, limit_ttl=100) | ||
|
||
@app.before_request() | ||
def middleware(request: Request): | ||
return limiter.handle_request(app, request) | ||
|
||
@app.get("/") | ||
def h(): | ||
return "Hello, World!" | ||
|
||
app.start(port=8080) | ||
``` | ||
In this example, robyn-rate-limits is used to enforce a rate limit of 3 requests per 100-seconds window for specific routes. If a client exceeds this limit, they will receive a "Too many requests" message. | ||
|
||
The plugin integrates seamlessly with the Robyn web framework, enhancing the security and stability of your application by preventing excessive requests from a single client. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from collections.abc import Callable | ||
import pytest | ||
from integration_tests.helpers.http_methods_helpers import get, post, put | ||
|
||
|
||
@pytest.mark.benchmark | ||
@pytest.mark.usefixtures("session") | ||
@pytest.mark.parametrize( | ||
"route,method", | ||
[ | ||
("/sync/get/no_dec", get), | ||
("/async/get/no_dec", get), | ||
("/sync/put/no_dec", put), | ||
("/async/put/no_dec", put), | ||
("/sync/post/no_dec", post), | ||
("/async/post/no_dec", post), | ||
], | ||
) | ||
def test_exception_handling(route: str, method: Callable): | ||
r = method(route, expected_status_code=200) | ||
assert r.text == "Success!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "maturin" | |
|
||
[project] | ||
name = "robyn" | ||
version = "0.38.0" | ||
version = "0.39.0" | ||
description = "A High-Performance, Community-Driven, and Innovator Friendly Web Framework with a Rust runtime." | ||
authors = [{ name = "Sanskar Jethi", email = "[email protected]" }] | ||
repository = "https://github.com/sparckles/robyn" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters