This commit is contained in:
2024-11-25 17:23:00 +01:00
parent 69295768d5
commit 34a375c50d
12 changed files with 618 additions and 91 deletions

40
steam_api.py Normal file
View File

@@ -0,0 +1,40 @@
import requests
import json
# Steam-API-Einheitspunkt
STEAM_API_URL = "https://api.steampowered.com"
# Benutzer-ID oder Anwendung-ID
USER_ID = "76561197999844867" # ersetzen Sie mit der ID des Benutzers oder der Anwendung, für die Sie Informationen benötigen
def get_user_info(user_id):
"""
Ruft die Information über einen bestimmten Benutzer ab.
"""
url = f"{STEAM_API_URL}/ISteamUser/GetPlayerSummarInfo/v0001/?key=80BED3ACB9E38E5A944F2BEB26FC9C3E&steamids={user_id}"
response = requests.get(url)
data = json.loads(response.content)
return data
def get_app_info(app_id):
"""
Ruft die Information über eine bestimmte Anwendung ab.
"""
url = f"{STEAM_API_URL}/ISteamApp/GetAppList/v0001/?key=80BED3ACB9E38E5A944F2BEB26FC9C3E&appids={app_id}"
response = requests.get(url)
data = json.loads(response.content)
return data
def main():
user_info = get_user_info(USER_ID)
print("Benutzer-Informationen:")
for key, value in user_info["response"]["summarizeForPublic"]["player"].items():
print(f"{key}: {value}")
app_info = get_app_info(USER_ID) # oder USER_ID
print("\nAnwendung-Informationen:")
for item in app_info["app_list"]:
print(f"Name: {item['name']}, App ID: {item['appid']}")
if __name__ == "__main__":
main()