Comments (2)
I got it!
from responder.
@kennethreitz Thank you!
There seems to be a different error now though, this time when non-async format_json()
tries to pass Request.content
coroutine to json.loads()
. I guess format_json()
needs to be async
as well?
tests/test_responder.py:123:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.env/lib/python3.7/site-packages/requests/sessions.py:559: in post
return self.request('POST', url, data=data, json=json, **kwargs)
.env/lib/python3.7/site-packages/starlette/testclient.py:312: in request
json=json,
.env/lib/python3.7/site-packages/requests/sessions.py:512: in request
resp = self.send(prep, **send_kwargs)
.env/lib/python3.7/site-packages/requests/sessions.py:622: in send
r = adapter.send(request, **kwargs)
.env/lib/python3.7/site-packages/starlette/testclient.py:159: in send
raise exc from None
.env/lib/python3.7/site-packages/starlette/testclient.py:156: in send
loop.run_until_complete(connection(receive, send))
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py:568: in run_until_complete
return future.result()
responder/api.py:71: in asgi
resp = await self._dispatch_request(req)
responder/api.py:112: in _dispatch_request
await self.graphql_response(req, resp, schema=view)
responder/api.py:200: in graphql_response
query = await self._resolve_graphql_query(req)
responder/api.py:180: in _resolve_graphql_query
return await req.media("json")["query"]
responder/models.py:197: in media
return self.formats[format](self)
responder/formats.py:23: in format_json
return json.loads(r.content)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
s = <coroutine object Request.content at 0x104cc49c8>, encoding = None, cls = None, object_hook = None, parse_float = None, parse_int = None, parse_constant = None
object_pairs_hook = None, kw = {}
def loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
if not isinstance(s, (bytes, bytearray)):
> raise TypeError(f'the JSON object must be str, bytes or bytearray, '
f'not {s.__class__.__name__}')
E TypeError: the JSON object must be str, bytes or bytearray, not coroutine
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py:341: TypeError
==================================================================== 1 failed, 43 passed in 0.44 seconds =====================================================================
sys:1: RuntimeWarning: coroutine 'Request.content' was never awaited
Sorry I'm not fixing this myself – I tried yesterday but got too deep into asyncio
hole and some of the changes didn't feel right to me.
from responder.
Related Issues (20)
- Docs: being more explicit about why to use api.background.task HOT 2
- Add documentation for response streaming
- Stop stream response if client disconnects HOT 1
- [Feature Request] OpenAPI Schema Support with Pydantic
- Potential code quality improvements HOT 7
- MultiRelay not working - Blank screen
- Run with workers argument doesn't work
- api.jinja_values_base removed? HOT 2
- AttributeError: module 'typesystem' has no attribute 'SchemaDefinitions' HOT 2
- Fail to install: Python 3.9 HOT 5
- AttributeError: 'str' object has no attribute 'decode'
- Missing uvloop on default setup HOT 3
- Static file changes require server restart
- [Feature Request] - request context middleware like starlette-context
- AttributeError: module 'typesystem' has no attribute 'SchemaDefinitions': incompatibility with typesystem v0.3.0 HOT 1
- Uvicorn version too old ?
- doc website 404 HOT 1
- Vulnerability in referenced starlette version
- Can't install on Debian bookworm with python 3. HOT 1
- New release pending? / Python >= 3.11 need a compiler when installing HOT 1
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 responder.