Skip to main content

A simple api to get player stats for TF2

Project description

TF2 API

A simple tf2 API!

Example:

from tf2 import TF2
import getpass4

tf2 = TF2(str(getpass4.getpass('Enter Steam Web API Key: ' , '*')), 123456789012345) # the getpass4 thing is a password thing. You can put a string with the api key there.

scoutk = tf2.get_kills_as_class('Scout')
heavyk = tf2.get_kills_as_class('Heavy')
pyrok = tf2.get_kills_as_class('Pyro')
spyk = tf2.get_kills_as_class('Spy')
medick = tf2.get_kills_as_class('Medic')
sniperk = tf2.get_kills_as_class('Sniper')
soldierk = tf2.get_kills_as_class('Soldier')
engineerk = tf2.get_kills_as_class('Engineer')
demomank = tf2.get_kills_as_class('Demoman')

total_kills = scoutk + heavyk + pyrok + spyk + medick + sniperk + soldierk + engineerk + demomank

print(f"Total Kills (All Classes): {total_kills}")

print("--------------------------------------")

scoutp = tf2.get_playtime_as_class('Scout')
heavyp = tf2.get_playtime_as_class('Heavy')
pyrop = tf2.get_playtime_as_class('Pyro')
spyp = tf2.get_playtime_as_class('Spy')
medicp = tf2.get_playtime_as_class('Medic')
sniperp = tf2.get_playtime_as_class('Sniper')
soldierp = tf2.get_playtime_as_class('Soldier')
engineerp = tf2.get_playtime_as_class('Engineer')
demomanp = tf2.get_playtime_as_class('Demoman')

print(f"""
Scout playtime: {scoutp}
Heavy Playtime: {heavyp}
Pyro Playtime: {pyrop}
Spy Playtime: {spyp}
Medic Playtime: {medicp}
Sniper Playtime: {sniperp}
Soldier Playtime: {soldierp}
Engineer Playtime: {engineerp}
Demoman Playtime: {demomanp}
""")

print("--------------------------------------")

print(f"""
PyPi Page: {tf2.pypi_page}
Github Page: {tf2.github_page}
""")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tf2_api-0.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file tf2_api-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tf2_api-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for tf2_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3fb4fd8b5a309d8fd4d2a010b19858d4a9b5c1e038b1b64dcba7563796491a41
MD5 51a8bd18bc9079a33d6b70dbf4ccd4af
BLAKE2b-256 ee94bd974add2a9d539c202ad2f4201198e936562bf4d569bebf266c5e8d1e36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page