forked from fair/matrix-puppeteer-line
Lower minimum required Python version to 3.7
Just use Dict instead of TypedDict
This commit is contained in:
parent
4e21113940
commit
120e4e11f7
2
SETUP.md
2
SETUP.md
|
@ -1,5 +1,5 @@
|
||||||
# Minimum Requirements
|
# Minimum Requirements
|
||||||
* Python 3.8
|
* Python 3.7
|
||||||
* Node 10.18.1
|
* Node 10.18.1
|
||||||
* yarn 1.22.x
|
* yarn 1.22.x
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
from typing import AsyncGenerator, TypedDict, List, Tuple, Dict, Callable, Awaitable, Any
|
from typing import AsyncGenerator, List, Tuple, Dict, Callable, Awaitable, Any
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@ -22,10 +22,6 @@ from .rpc import RPCClient
|
||||||
from .types import ChatEvents, ChatListInfo, ChatInfo, ImageData, Message, Participant, Receipt, StartStatus
|
from .types import ChatEvents, ChatListInfo, ChatInfo, ImageData, Message, Participant, Receipt, StartStatus
|
||||||
|
|
||||||
|
|
||||||
class LoginCommand(TypedDict):
|
|
||||||
content: str
|
|
||||||
|
|
||||||
|
|
||||||
class Client(RPCClient):
|
class Client(RPCClient):
|
||||||
async def start(self) -> StartStatus:
|
async def start(self) -> StartStatus:
|
||||||
await self.connect()
|
await self.connect()
|
||||||
|
@ -113,19 +109,19 @@ class Client(RPCClient):
|
||||||
data = deque()
|
data = deque()
|
||||||
event = asyncio.Event()
|
event = asyncio.Event()
|
||||||
|
|
||||||
async def qr_handler(req: LoginCommand) -> None:
|
async def qr_handler(req: Dict[str, str]) -> None:
|
||||||
data.append(("qr", req["url"]))
|
data.append(("qr", req["url"]))
|
||||||
event.set()
|
event.set()
|
||||||
|
|
||||||
async def pin_handler(req: LoginCommand) -> None:
|
async def pin_handler(req: Dict[str, str]) -> None:
|
||||||
data.append(("pin", req["pin"]))
|
data.append(("pin", req["pin"]))
|
||||||
event.set()
|
event.set()
|
||||||
|
|
||||||
async def success_handler(req: LoginCommand) -> None:
|
async def success_handler(req: Dict[str, str]) -> None:
|
||||||
data.append(("login_success", None))
|
data.append(("login_success", None))
|
||||||
event.set()
|
event.set()
|
||||||
|
|
||||||
async def failure_handler(req: LoginCommand) -> None:
|
async def failure_handler(req: Dict[str, str]) -> None:
|
||||||
data.append(("login_failure", req.get("reason")))
|
data.append(("login_failure", req.get("reason")))
|
||||||
event.set()
|
event.set()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue