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

[WIP] chore: fix the wrong types in the library #1109

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,7 @@ Batman was curious about how to access path parameters and query parameters from
<CodeGroup title="Request" tag="GET" label="/split_request_params">

```python
from robyn.robyn import QueryParams, Headers
from robyn.types import PathParams, RequestMethod, RequestBody, RequestURL
from robyn import QueryParams, Headers, PathParams, Method, Body, URL

@app.get("/untyped/query_params")
def untyped_basic(query_params):
Expand All @@ -346,9 +345,9 @@ Batman was curious about how to access path parameters and query parameters from
@app.post("/typed_untyped/combined")
def typed_untyped_combined(
query_params,
method_data: RequestMethod,
body_data: RequestBody,
url: RequestURL,
method_data: Method,
body_data: Body,
url: URL,
headers_item: Headers,
):
return {
Expand All @@ -364,7 +363,7 @@ Batman was curious about how to access path parameters and query parameters from
</Col>
</Row>

Type Aliases: `Request`, `QueryParams`, `Headers`, `PathParams`, `RequestBody`, `RequestMethod`, `RequestURL`, `FormData`, `RequestFiles`, `RequestIP`, `RequestIdentity`
Type Aliases: `Request`, `QueryParams`, `Headers`, `PathParams`, `Body`, `URL`, `FormData`, `Files`, `IPAddress`, `Identity`

Reserved Names: `r`, `req`, `request`, `query_params`, `headers`, `path_params`, `body`, `method`, `url`, `ip_addr`, `identity`, `form_data`, `files`

Expand Down
12 changes: 10 additions & 2 deletions robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from robyn.processpool import run_processes
from robyn.reloader import compile_rust_files
from robyn.responses import html, serve_file, serve_html
from robyn.robyn import FunctionInfo, Headers, HttpMethod, Request, Response, WebSocketConnector, get_version
from robyn.robyn import FunctionInfo, Headers, HttpMethod, Request, Response, WebSocketConnector, get_version, Url
from robyn.router import MiddlewareRouter, MiddlewareType, Router, WebSocketRouter
from robyn.types import Directory
from robyn.types import Directory, PathParams, Method, FormData, Files, IPAddress, Body
from robyn.ws import WebSocket

__version__ = get_version()
Expand Down Expand Up @@ -656,4 +656,12 @@ def cors_middleware(request):
"Headers",
"WebSocketConnector",
"WebSocket",
"Directory",
"PathParams",
"Method",
"FormData",
"Files",
"IPAddress",
"Body",
"Url",
]
2 changes: 1 addition & 1 deletion robyn/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ class Body:
pass


__all__ = ["JSONResponse", "Body"]
__all__ = ["JSONResponse", "Body", "Directory", "PathParams", "Method", "FormData", "Files", "IPAddress"]
Loading