Z
Z
Zagir Majidov2022-03-22 21:19:15
API
Zagir Majidov, 2022-03-22 21:19:15

Quart_discord Why is there an error in discord.create_session()?

Everything works for me, but when I call await discord.create_session() I get a session related error.
PS Operating system: Linux mint cinnamon, latest version of quart-discord.
The code:

@app.route("/login")
async def login():
  try:
    return await discord.create_session()
  except Exception as e:
    print(e)
    return "Sorry, error"

Mistake:
object Response can't be used in 'await' expression
[2022-03-22 20:21:33,825] Request handling exception
Traceback (most recent call last):
  File "/home/xpeawey/.local/lib/python3.8/site-packages/quart/serving.py", line 130, in _handle_request
    await self.send_response(stream_id, response)
  File "/home/xpeawey/.local/lib/python3.8/site-packages/quart/serving.py", line 229, in send_response
    self._send(h11.Response(status_code=response.status_code, headers=headers))
  File "/home/xpeawey/.local/lib/python3.8/site-packages/h11/_events.py", line 55, in __init__
    self.headers = _headers.normalize_and_validate(
  File "/home/xpeawey/.local/lib/python3.8/site-packages/h11/_headers.py", line 77, in normalize_and_validate
    validate(_field_value_re, value, "Illegal header value {!r}", value)
  File "/home/xpeawey/.local/lib/python3.8/site-packages/h11/_util.py", line 108, in validate
    raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b' session=eyJESVNDT1JEX09BVVRIMl9TVEFURSI6ImV5SjBlWEFpT2lKS1YxUWlMQ0poYkdjaU9pSklVekkxTmlKOS5lMzAuSU1YT3I4S0ZqOHRZWDlmS2h5X19fNFJsM2tZVXZBeEZ4bWhsaE5KV3dOQSJ9.YjoFnQ.AAHmvAk-ZeUMVVEX0lD1irMRzKE; HttpOnly; Path=/'

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question