Skip to main content

Python wrapper for SteamCMD

Project description

Py-SteamCMD-Wrapper

coverage HitCount

During the setup of game servers it can be infuriating to use SteamCMD due to some particularities within the SteamCMD Toolkit. This simple wrapper for python will handle everything from installation to downloading games.

Getting Started

These instructions will get you a copy of the project up and running on your machine for development and testing purposes

Prerequisites

When installing on linux, you'll need the 32-bit libraries specified on the valvesoftware website.

Ubuntu

sudo apt-get install lib32stdc++6

If you get an error for missing dependencies or broken packages, run the following

 dpkg --add-architecture i386
 apt-get update
 apt-get install lib32gcc1

RHEL, Fedora, CentOS, etc.

yum install glibc.i686 libstdc++.i686

Arch Linux

Enable the multilib repository

pacman -S lib32-gcc-libs

Installing

Run the following command to install the package

pip install py-steamcmd-wrapper

In order to install steam using this wrapper you'll have to do the following:

from pysteamcmdwrapper import SteamCMD

steam = SteamCMD("MyInstallationDir")
steam.install()

Usage

Curently there are 4 methods available in the wrapper. These are as follows:

  • install
  • login
  • app_update
  • workshop_update

You can use these methods to install steamcmd, login a user, download a game/gameserver or a workshop mod. If your game needs a valid subscription (AKA you've bought the game) the login function needs to be called. When left empty, it will prompt for login information.

A small code snippet to install an Arma III dedicated server with CBA_A3 installed

import os
from pysteamcmdwrapper import SteamCMD, SteamCMDException

SERVER_DIR = "armaserver"
WORKSHOP_DIR = os.path.join(os.getcwd(),"armamods","steamapps","workshop","content","107410")
MOD_DIR = os.path.join(os.getcwd(),SERVER_DIR)

s = SteamCMD("steamcmd")
try:
    s.install()
except SteamCMDException:
    print("Already installed, try to use the --force option to force installation")

s.login()
s.app_update(233780,os.path.join(os.getcwd(),SERVER_DIR),validate=True)

modname = "cba_a3"
id = "450814997"
s.workshop_update(107410,id,os.path.join(os.getcwd(),"armamods/"),validate=True)
try:
    os.symlink(os.path.join(WORKSHOP_DIR,id),os.path.join(MOD_DIR,"@"+modname))
except FileExistsError:
    print("Already linked")
keydir = os.path.join(MOD_DIR,"@"+modname,"keys")
if not os.path.isdir(keydir):
    keydir = os.path.join(MOD_DIR,"@"+modname,"key")
for key in os.listdir(keydir):
    print("Linking ",key)
    try:
        os.symlink(os.path.join(keydir,key),os.path.join(MOD_DIR,"keys",key))
    except FileExistsError:
        print("Already Linked")

This snippet can be used with another project of mine. This will be coming soon!

The login function is only needed when a subscription to the game is needed. The wrapper uses the 'Anonymous' user by default

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to me.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Wouter Mellema - Initial work - wmellema

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • f0rkz, whose original pysteamcmd project was abandoned, but still very usefull as a building block

Project details


Download files

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

Source Distribution

py-steamcmd-wrapper-1.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

py_steamcmd_wrapper-1.1.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file py-steamcmd-wrapper-1.1.1.tar.gz.

File metadata

  • Download URL: py-steamcmd-wrapper-1.1.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for py-steamcmd-wrapper-1.1.1.tar.gz
Algorithm Hash digest
SHA256 e65dea89917084d2450a373e3d335e8bbf731177c42c5614522fe9874c72883a
MD5 48eb1ad432ab1e3d509fc1fd74c88e3b
BLAKE2b-256 91feaf3c9e799942282739ec65e1cdf86465adf5bcd11f617711319e6eefacc1

See more details on using hashes here.

File details

Details for the file py_steamcmd_wrapper-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: py_steamcmd_wrapper-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for py_steamcmd_wrapper-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 750643e244903e0e475c2fb36c0d3cc82dbb589af9f3adcb0685aef52de95ac7
MD5 bcbb26dd66ae6e26ce33b641b77f5214
BLAKE2b-256 02a8f56ad1c7773c4b7f00032cb2438ddceb96498865e38869c277d2dff89b52

See more details on using hashes here.

Supported by

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