Skip to content

Commit 9599ce6

Browse files
authored
Update app.py
1 parent 4afec6b commit 9599ce6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

app.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import requests
55
import re
66
import base64
7-
import logging
7+
import logging
88
from urllib.parse import unquote
99

1010
app = Flask("Secured Signal Api")
@@ -76,18 +76,18 @@ def middlewares():
7676
auth_header = request.headers.get("Authorization", "")
7777

7878
if auth_header.startswith("Bearer "):
79-
token = auth_header.split(" ", 1)[1]
80-
79+
token = auth_header.split(" ", 1)[1]
80+
8181
token = unquote(token)
8282
if token != API_TOKEN:
8383
infoLog(f"Client failed Bearer Auth [token: {token}]")
84-
return UnauthorizedResponse()
84+
return UnauthorizedResponse()
8585
elif auth_header.startswith("Basic "):
8686
try:
8787
decoded = base64.b64decode(auth_header.split(" ", 1)[1]).decode()
88-
username, password = decoded.split(":", 1)
89-
90-
username = unquote(username)
88+
username, password = decoded.split(":", 1)
89+
90+
username = unquote(username)
9191
password = unquote(password)
9292
if username != "api" or password != API_TOKEN:
9393
infoLog(f"Client failed Basic Auth [user: {username}, pw:{password}]")
@@ -169,4 +169,4 @@ def errorLog(msg):
169169
"RECIPIENTS": DEFAULT_RECIPIENTS
170170
}
171171

172-
app.run(debug=False, port=8880, host='0.0.0.0')
172+
app.run(debug=False, port=8880, host='0.0.0.0')

0 commit comments

Comments
 (0)