make into multiple different scripts to prevent breaking changes

This commit is contained in:
kittentm 2026-02-06 01:29:26 +01:00
commit 3ca5cc73f0
5 changed files with 70 additions and 73 deletions

24
services/auth.py Normal file
View file

@ -0,0 +1,24 @@
import requests
import base64
API_URL = "https://account.spfn.net/api/v2"
def get_token(username, password):
creds = f"{username} {password}"
encoded = base64.b64encode(creds.encode()).decode()
headers = {
"Authorization": f"Basic {encoded}",
"User-Agent": "saturday & allison should lwk kiss..."
}
response = requests.get(f"{API_URL}/oauth2/generate_token", headers=headers, timeout=10)
return response.json().get("token") if response.ok else None
def get_profile(token):
headers = {
"Authorization": f"Bearer {token}",
"User-Agent": "every update im going to change this user agent because im bored!!"
}
response = requests.get(f"{API_URL}/users/@me/profile", headers=headers, timeout=10)
return response.text if response.ok else None