Fixed typing from parse_qs

This commit is contained in:
FinnStutzenstein 2019-10-18 14:41:55 +02:00
parent d49f6124d3
commit 3f41890541
2 changed files with 5 additions and 2 deletions

1
.gitignore vendored
View File

@ -75,6 +75,7 @@ client/typings
client/yarn.lock client/yarn.lock
package-lock.json package-lock.json
client/package-lock.json client/package-lock.json
cypress.json
# System Files # System Files
client/.DS_Store client/.DS_Store

View File

@ -1,6 +1,6 @@
import time import time
from collections import defaultdict from collections import defaultdict
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional, cast
from urllib.parse import parse_qs from urllib.parse import parse_qs
from channels.generic.websocket import AsyncWebsocketConsumer from channels.generic.websocket import AsyncWebsocketConsumer
@ -55,7 +55,9 @@ class SiteConsumer(ProtocollAsyncJsonWebsocketConsumer):
logger.debug(f"connect: denied ({self._id})") logger.debug(f"connect: denied ({self._id})")
return return
query_string = parse_qs(self.scope["query_string"]) query_string = cast(
Dict[bytes, List[bytes]], parse_qs(self.scope["query_string"])
)
if b"change_id" in query_string: if b"change_id" in query_string:
try: try:
change_id = int(query_string[b"change_id"][0]) change_id = int(query_string[b"change_id"][0])