style: refactor codebase to adhere to PEP 8 formatting standards throughout all source files

This commit is contained in:
2026-05-12 23:55:58 +02:00
parent bcc11cb07e
commit 8e9e4c01d4
17 changed files with 443 additions and 171 deletions
+10 -6
View File
@@ -11,6 +11,7 @@ Required scopes:
Usage: uv run get_token.py
"""
import os
import webbrowser
import httpx
@@ -25,6 +26,7 @@ CLIENT_SECRET = os.getenv("STRAVA_CLIENT_SECRET")
REDIRECT_URI = "http://localhost:8765/callback"
SCOPES = "profile:read_all,activity:read_all,activity:read,profile:write"
class CallbackHandler(BaseHTTPRequestHandler):
client_id: str = ""
client_secret: str = ""
@@ -50,14 +52,15 @@ class CallbackHandler(BaseHTTPRequestHandler):
)
response.raise_for_status()
self.tokens = response.json()
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.end_headers()
refresh_token = self.tokens.get("refresh_token")
self.wfile.write(f"""
self.wfile.write(
f"""
<html>
<head>
<style>
@@ -103,7 +106,8 @@ STRAVA_REFRESH_TOKEN={refresh_token}</pre>
</p>
</body>
</html>
""".encode("utf-8"))
""".encode("utf-8")
)
except Exception as e:
self.error = str(e)
self.send_response(500)
@@ -176,7 +180,7 @@ def main():
print(f"STRAVA_CLIENT_SECRET={CLIENT_SECRET}")
print(f"STRAVA_REFRESH_TOKEN={refresh_token}")
print("-" * 40)
# Optional: Automatically update .env if it exists
try:
env_path = ".env"