joegasewicz / bobtail Goto Github PK
View Code? Open in Web Editor NEWA little Python WSGI http framework
Home Page: https://pypi.org/project/bobtail/
License: MIT License
A little Python WSGI http framework
Home Page: https://pypi.org/project/bobtail/
License: MIT License
[21-04-23 20:13:10] GET / 200
[2023-04-21 20:13:10 +0100] [14073] [ERROR] Error handling request /favicon.ico
Traceback (most recent call last):
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle
self.handle_request(listener, req, client, addr)
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
respiter = self.wsgi(environ, resp.start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/bobtail/wsgi.py", line 126, in call
self._handle_route()
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/bobtail/wsgi.py", line 94, in _handle_route
self.parse_metadata = p.route()
^^^^^^^^^
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/bobtail/parser.py", line 125, in route
route = self._match()
^^^^^^^^^^^^^
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/bobtail/parser.py", line 60, in _match
if route_segment[0] != "{" and route_segment != path_segment:
~~~~~~~~~~~~~^^^
IndexError: string index out of range
Create some test utilities
Although the code is compatible with 3.10 the tests aren't currently running on 3.10
Line 8 in 08c9a3b
Add the following metadata to the Request object:
protocol
domain
port
WSGI environ dict URI metadata
'wsgi.url_scheme': 'http',
'SERVER_NAME': '127.0.0.1',
'SERVER_PORT': '8000',
Further reading: https://peps.python.org/pep-3333/#url-reconstruction
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle
self.handle_request(listener, req, client, addr)
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
respiter = self.wsgi(environ, resp.start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/bobtail/wsgi.py", line 124, in __call__
self._init_response()
File "/home/joe/.local/share/virtualenvs/main_app-NxXa5jZN/lib/python3.11/site-packages/bobtail/wsgi.py", line 71, in _init_response
self.response = Response(self.options)
^^^^^^^^^^^^
AttributeError: 'BobTail' object has no attribute 'options'
Theme error:
no theme named 'sphinx_rtd_theme' found (missing theme.conf?)
Line 64 in 99b202a
This should only raise a RouteClassError
if the request method's class is uninitiated and not swallow other exceptions.
Make the path
value available through a method.
For example:
req.get_path()
And update the README.md with an example
The doc strings need to be completed as many are missing / incomplete
Examples using SQLAlchemy Core:
data = req.get_multipart_data()
ins = images.insert().values(
user_id=int(data["user_id"]["value"]),
file_name=data["logo"]["value"]["filename"],
noticeboard_id=int(data["noticeboard_id"]["value"]),
)
Check if vars has been assigned
File "/Users/joegasewicz/PycharmProjects/bobtail/bobtail/wsgi.py", line 91, in __call__
self._handle_route()
File "/Users/joegasewicz/PycharmProjects/bobtail/bobtail/wsgi.py", line 63, in _handle_route
self.request.set_args(self.parse_metadata["vars"])
File "/home/joe/.local/share/virtualenvs/file_server-a96Bzucb/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 136, in handle
self.handle_request(listener, req, client, addr)
File "/home/joe/.local/share/virtualenvs/file_server-a96Bzucb/lib/python3.11/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
respiter = self.wsgi(environ, resp.start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/joe/.local/share/virtualenvs/file_server-a96Bzucb/lib/python3.11/site-packages/bobtail/wsgi.py", line 100, in __call__
self.set_request()
File "/home/joe/.local/share/virtualenvs/file_server-a96Bzucb/lib/python3.11/site-packages/bobtail/wsgi.py", line 53, in set_request
headers=RequestHeaders(content_type=self.environ["CONTENT_TYPE"]),
~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'CONTENT_TYPE'
If there are no arguments in the URI path & req.get_arg
is called then RouteClassError
is raised.
Fix:
provide a new custom exception for this type of error.
Support wsgi.multithread=True
Duplicate the sample test and add one for each of the Status.code
s
This issue should add the following
We have a method to get the filename but not the actual file value.
See #49
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| _____________________|__
/ \ / \
urn:example:animal:ferret:nose
Create a form api that improves access to form data in the request
This will be implemented in an external library, possibly in Rust or C & will follow the
https://www.rfc-editor.org/rfc/rfc3986 ref.
#
- will be fixed in - #9if route_segment[0] != "{" and route_segment != path_segment: ~~~~~~~~~~~~~^^^
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.