small improvements
This commit is contained in:
parent
0636b68fb0
commit
91a4fdef48
4 changed files with 7 additions and 2 deletions
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Main module."""
|
||||
|
||||
import bumper
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ _logger = get_logger("confserver")
|
|||
|
||||
|
||||
def generate_token(user):
|
||||
"""Generate token."""
|
||||
try:
|
||||
tmpaccesstoken = uuid.uuid4().hex
|
||||
user_add_token(user["userid"], tmpaccesstoken)
|
||||
|
|
@ -46,6 +47,7 @@ def generate_token(user):
|
|||
|
||||
|
||||
def generate_authcode(user, countrycode, token):
|
||||
"""Generate auth token."""
|
||||
try:
|
||||
tmpauthcode = f"{countrycode}_{uuid.uuid4().hex}"
|
||||
user_add_authcode(user["userid"], token, tmpauthcode)
|
||||
|
|
@ -56,6 +58,7 @@ def generate_authcode(user, countrycode, token):
|
|||
|
||||
|
||||
async def login(request):
|
||||
"""Perform login."""
|
||||
try:
|
||||
user_devid = request.match_info.get("devid", "")
|
||||
countrycode = request.match_info.get("country", "us")
|
||||
|
|
@ -124,6 +127,7 @@ async def login(request):
|
|||
|
||||
|
||||
async def get_authcode(request: Request) -> Response:
|
||||
"""Get auth code."""
|
||||
try:
|
||||
user_devid = request.match_info.get("devid", None) # Ecovacs
|
||||
if not user_devid:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import json
|
|||
import logging
|
||||
import os
|
||||
import ssl
|
||||
from typing import Union
|
||||
|
||||
import aiohttp_jinja2
|
||||
import jinja2
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
aiohttp==3.8.1
|
||||
aiohttp-jinja2==1.5
|
||||
git+https://github.com/Yakifo/amqtt@master#amqtt==11.0.0
|
||||
cachetools==5.1.0
|
||||
git+https://github.com/Yakifo/amqtt@master#amqtt==11.0.0
|
||||
gmqtt==0.6.11
|
||||
Jinja2==3.1.2
|
||||
tinydb==4.7.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue