smdb-web-server 2.0.2__tar.gz → 2.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {smdb_web_server-2.0.2/smdb_web_server.egg-info → smdb_web_server-2.0.3}/PKG-INFO +4 -4
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/README.md +3 -3
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/setup.cfg +1 -1
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/HTTPRequestHandler.py +6 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/__init__.py +2 -2
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/data/Constants.py +3 -2
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3/smdb_web_server.egg-info}/PKG-INFO +4 -4
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/LICENSE +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/pyproject.toml +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/HTMLServer.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/data/Base.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/data/Protocol.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/data/ResponseCode.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/data/Timer.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/data/UrlData.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/data/__init__.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/data/wrappers.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/errors/CloseException.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/errors/KnownError.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/errors/RequestException.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server/errors/__init__.py +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server.egg-info/SOURCES.txt +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server.egg-info/dependency_links.txt +0 -0
- {smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: smdb_web_server
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: A really basic, not so safe web server.
|
|
5
5
|
Home-page: https://github.com/NightKey/smdb-server
|
|
6
6
|
Author: Janthó Dávid
|
|
@@ -93,7 +93,7 @@ To do this with the whole application, set the same flag to true, when instantia
|
|
|
93
93
|
|
|
94
94
|
## GET handler
|
|
95
95
|
|
|
96
|
-
This handler can return any string, but it's useful, if it returns an HTML file as string. This can be a hardcoded HTML code, or a static or dynamic file. For rendering HTML template files, the server has a helper function called `render_template_file`. This can render an HTML file from a pre
|
|
96
|
+
This handler can return any string, but it's useful, if it returns an HTML file as string. This can be a hardcoded HTML code, or a static or dynamic file. For rendering HTML template files, the server has a helper function called `render_template_file`. This can render an HTML file from a pre-setup dictionary.
|
|
97
97
|
|
|
98
98
|
```python
|
|
99
99
|
def index_handler(url_data: UrlData) -> str:
|
|
@@ -123,7 +123,7 @@ This list will be sent as a `plaintext` response.
|
|
|
123
123
|
|
|
124
124
|
## Put Handler
|
|
125
125
|
|
|
126
|
-
This handler can return a simple string. The incoming data will be
|
|
126
|
+
This handler can return a simple string or None. The incoming data will be the [UrlData](#urldata) of the request.
|
|
127
127
|
```python
|
|
128
128
|
from smdb_web_server import Protocol
|
|
129
129
|
|
|
@@ -137,7 +137,7 @@ server.add_url_rule("/put", put_handler, Protocol.Put)
|
|
|
137
137
|
|
|
138
138
|
## Post Handler
|
|
139
139
|
|
|
140
|
-
This handler can return a simple string. The incoming data will be
|
|
140
|
+
This handler can return a simple string or None. The incoming data will be the [UrlData](#urldata) of the request.
|
|
141
141
|
```python
|
|
142
142
|
rom smdb_web_server import Protocol
|
|
143
143
|
|
|
@@ -76,7 +76,7 @@ To do this with the whole application, set the same flag to true, when instantia
|
|
|
76
76
|
|
|
77
77
|
## GET handler
|
|
78
78
|
|
|
79
|
-
This handler can return any string, but it's useful, if it returns an HTML file as string. This can be a hardcoded HTML code, or a static or dynamic file. For rendering HTML template files, the server has a helper function called `render_template_file`. This can render an HTML file from a pre
|
|
79
|
+
This handler can return any string, but it's useful, if it returns an HTML file as string. This can be a hardcoded HTML code, or a static or dynamic file. For rendering HTML template files, the server has a helper function called `render_template_file`. This can render an HTML file from a pre-setup dictionary.
|
|
80
80
|
|
|
81
81
|
```python
|
|
82
82
|
def index_handler(url_data: UrlData) -> str:
|
|
@@ -106,7 +106,7 @@ This list will be sent as a `plaintext` response.
|
|
|
106
106
|
|
|
107
107
|
## Put Handler
|
|
108
108
|
|
|
109
|
-
This handler can return a simple string. The incoming data will be
|
|
109
|
+
This handler can return a simple string or None. The incoming data will be the [UrlData](#urldata) of the request.
|
|
110
110
|
```python
|
|
111
111
|
from smdb_web_server import Protocol
|
|
112
112
|
|
|
@@ -120,7 +120,7 @@ server.add_url_rule("/put", put_handler, Protocol.Put)
|
|
|
120
120
|
|
|
121
121
|
## Post Handler
|
|
122
122
|
|
|
123
|
-
This handler can return a simple string. The incoming data will be
|
|
123
|
+
This handler can return a simple string or None. The incoming data will be the [UrlData](#urldata) of the request.
|
|
124
124
|
```python
|
|
125
125
|
rom smdb_web_server import Protocol
|
|
126
126
|
|
|
@@ -224,6 +224,9 @@ class HTTPRequestHandler(Base):
|
|
|
224
224
|
result = await callback(self.data)
|
|
225
225
|
else:
|
|
226
226
|
result = callback(self.data)
|
|
227
|
+
if result is None:
|
|
228
|
+
message_return = Constants.OkNoResponse
|
|
229
|
+
result = ""
|
|
227
230
|
self.disable_cache = put_rules[self.path][1] or self.disable_cache
|
|
228
231
|
except KnownError as ke:
|
|
229
232
|
message_return = ke.response
|
|
@@ -259,6 +262,9 @@ class HTTPRequestHandler(Base):
|
|
|
259
262
|
result = await callback(self.data)
|
|
260
263
|
else:
|
|
261
264
|
result = callback(self.data)
|
|
265
|
+
if result is None:
|
|
266
|
+
message_return = Constants.OkNoResponse
|
|
267
|
+
result = ""
|
|
262
268
|
message_return = Constants.Ok
|
|
263
269
|
self.disable_cache = post_rules[self.path][1] or self.disable_cache
|
|
264
270
|
except KnownError as ke:
|
|
@@ -4,8 +4,8 @@ from .data import *
|
|
|
4
4
|
from .errors import *
|
|
5
5
|
|
|
6
6
|
get_rules: Dict[str, Tuple[Union[Callable[[UrlData], str], Callable[[UrlData], Coroutine[Any, Any, str]]], bool]] = {}
|
|
7
|
-
put_rules: Dict[str, Tuple[Union[Callable[[UrlData], str], Callable[[UrlData], Coroutine[Any, Any, str]]], bool]] = {}
|
|
8
|
-
post_rules: Dict[str, Tuple[Union[Callable[[UrlData], str], Callable[[UrlData], Coroutine[Any, Any, str]]], bool]] = {}
|
|
7
|
+
put_rules: Dict[str, Tuple[Union[Callable[[UrlData], Union[str, None]], Callable[[UrlData], Coroutine[Any, Any, Union[str, None]]]], bool]] = {}
|
|
8
|
+
post_rules: Dict[str, Tuple[Union[Callable[[UrlData], Union[str, None]], Callable[[UrlData], Coroutine[Any, Any, Union[str, None]]]], bool]] = {}
|
|
9
9
|
TEMPLATES: Dict[str, str] = {}
|
|
10
10
|
STATIC: Dict[str, str] = {}
|
|
11
11
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from smdb_web_server.data.ResponseCode import ResponseCode
|
|
2
2
|
|
|
3
3
|
class Constants:
|
|
4
|
+
Ok = ResponseCode(200, "Ok")
|
|
5
|
+
OkNoResponse = ResponseCode(204, "No Content")
|
|
4
6
|
NotFound = ResponseCode(404, "Not Found")
|
|
5
7
|
Forbidden = ResponseCode(403, "Forbidden")
|
|
6
|
-
Ok = ResponseCode(200, "Ok")
|
|
7
|
-
InternalServerError = ResponseCode(500, "Internal Server Error")
|
|
8
8
|
BadRequest = ResponseCode(400, "Bad Request")
|
|
9
9
|
TPot = ResponseCode(418, "I'm a teapot")
|
|
10
|
+
InternalServerError = ResponseCode(500, "Internal Server Error")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: smdb_web_server
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: A really basic, not so safe web server.
|
|
5
5
|
Home-page: https://github.com/NightKey/smdb-server
|
|
6
6
|
Author: Janthó Dávid
|
|
@@ -93,7 +93,7 @@ To do this with the whole application, set the same flag to true, when instantia
|
|
|
93
93
|
|
|
94
94
|
## GET handler
|
|
95
95
|
|
|
96
|
-
This handler can return any string, but it's useful, if it returns an HTML file as string. This can be a hardcoded HTML code, or a static or dynamic file. For rendering HTML template files, the server has a helper function called `render_template_file`. This can render an HTML file from a pre
|
|
96
|
+
This handler can return any string, but it's useful, if it returns an HTML file as string. This can be a hardcoded HTML code, or a static or dynamic file. For rendering HTML template files, the server has a helper function called `render_template_file`. This can render an HTML file from a pre-setup dictionary.
|
|
97
97
|
|
|
98
98
|
```python
|
|
99
99
|
def index_handler(url_data: UrlData) -> str:
|
|
@@ -123,7 +123,7 @@ This list will be sent as a `plaintext` response.
|
|
|
123
123
|
|
|
124
124
|
## Put Handler
|
|
125
125
|
|
|
126
|
-
This handler can return a simple string. The incoming data will be
|
|
126
|
+
This handler can return a simple string or None. The incoming data will be the [UrlData](#urldata) of the request.
|
|
127
127
|
```python
|
|
128
128
|
from smdb_web_server import Protocol
|
|
129
129
|
|
|
@@ -137,7 +137,7 @@ server.add_url_rule("/put", put_handler, Protocol.Put)
|
|
|
137
137
|
|
|
138
138
|
## Post Handler
|
|
139
139
|
|
|
140
|
-
This handler can return a simple string. The incoming data will be
|
|
140
|
+
This handler can return a simple string or None. The incoming data will be the [UrlData](#urldata) of the request.
|
|
141
141
|
```python
|
|
142
142
|
rom smdb_web_server import Protocol
|
|
143
143
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smdb_web_server-2.0.2 → smdb_web_server-2.0.3}/smdb_web_server.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|