capture forbidden errors

This commit is contained in:
Will McGugan
2023-09-03 17:01:30 +01:00
parent 5e381118aa
commit 4290e73cc2
3 changed files with 23 additions and 3 deletions

View File

@@ -1,6 +1,5 @@
[account]
[app.Calculator]
path = "./"
command = "python calculator.py"

View File

@@ -1,3 +1,5 @@
from __future__ import annotations
import json
from pathlib import Path
import re
@@ -87,6 +89,13 @@ class Form(Container):
Form Input {
border: tall transparent;
}
Form Label.info {
text-align: left;
padding: 0 1 0 1;
color: $warning 70%;
}
"""
@@ -185,6 +194,12 @@ class ErrorLabel(Label):
class SignupScreen(Screen):
@property
def app(self) -> SignUpApp:
app = super().app
assert isinstance(app, SignUpApp)
return app
def compose(self) -> ComposeResult:
with Form():
yield Label("Textual-web Signup", classes="title")
@@ -196,8 +211,10 @@ class SignupScreen(Screen):
yield Label("Account slug*")
with SignupInput(id="account_slug"):
yield Input(placeholder="Identifier used in URLs")
yield ErrorLabel()
with Vertical(classes="group"):
yield Input(placeholder="Identifier used in URLs")
yield Label("First come, first serve (pick wisely)", classes="info")
yield ErrorLabel()
yield Label("Email*")
with SignupInput(id="email"):

View File

@@ -10,6 +10,7 @@ from typing import TYPE_CHECKING, Union, cast
import aiohttp
import msgpack
from aiohttp.client_exceptions import WSServerHandshakeError
from . import constants, packets
from .environment import Environment
@@ -239,6 +240,9 @@ class GanglionClient(Handlers):
break
except asyncio.CancelledError:
raise
except WSServerHandshakeError:
if retry_count == 1:
log.warning("Received forbidden response, check your API Key")
except Exception as error:
if retry_count == 1:
log.warning(