Comments (2)
Case: Add an additional question when I use emmett develop --interface asgi
I generate a new request whose headers["Api-key"]="not_foobar", otherwise condition will not work properly.
Expected: otherwise return {"error": "not authorized"}
Traceback (most recent call last):
File "D:\Anaconda\envs\emmett-frame\lib\asyncio\events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "D:\Anaconda\envs\emmett-frame\lib\site-packages\emmett\asgi\handlers.py", line 194, in __call__
await asyncio.wait_for(
File "D:\Anaconda\envs\emmett-frame\lib\asyncio\tasks.py", line 455, in wait_for
return await fut
File "D:\Anaconda\envs\emmett-frame\lib\site-packages\emmett\http.py", line 112, in asgi
await self._send_body(send)
File "D:\Anaconda\envs\emmett-frame\lib\site-packages\emmett\http.py", line 165, in _send_body
'body': self.encoded_body,
File "D:\Anaconda\envs\emmett-frame\lib\site-packages\emmett\http.py", line 160, in encoded_body
return self.body.encode('utf-8')
AttributeError: 'dict' object has no attribute 'encode'
Test
import requests
url = "http://localhost:8000/todo"
headers = {"Api-Key": "not_foobar"}
response = requests.get(url, headers=headers)
if response.status_code == 200:
tasks = response.json()["tasks"]
print(tasks)
else:
print("Error:", response.status_code, response.json())
from emmett.
My bad I didn't check the README example was still valid with 2.5
You can find the updated code in master
from emmett.
Related Issues (20)
- Allow 2.4 installs on Python 3.11
- Bug with Self references HOT 3
- Using migrations outside Emmett HOT 1
- Use async drivers for database operations HOT 1
- Error on running bloggy auth HOT 4
- hello, is there a generator for Patterns ? Package pattern and MVC pattern. Thanks HOT 2
- Selecting fields when joining relationships HOT 1
- BLOB type is always decoded to string HOT 2
- Improved type hinting for models HOT 1
- Custom (plural) name for relationships HOT 1
- Empty select field returns empty string instead of None HOT 4
- Async function db insert returns ValueError HOT 4
- Feature request widget_multiple_string_fields HOT 1
- Feature request readable, writable fields HOT 1
- Trying to do list:reference returns error HOT 6
- Copy or clone row
- Docs Website is 503 HTTP Error HOT 1
- failed to install using python version 3.12 HOT 1
- Offering help with framework related bug fixes :)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emmett.