GithubHelp home page GithubHelp logo

unazed / steamquery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jason2605/steamquery

0.0 1.0 0.0 20 KB

Small library to interact with the Steam API

License: GNU General Public License v3.0

Python 100.00%

steamquery's Introduction

SteamQuery

SteamQuery allows you to gather information about a steam server and return it in a dictionary format

Installing

Installing via pip

$ pip install steamquery

How to use

Standard use

>>> from steam import SteamQuery
>>> server_obj = SteamQuery("serverip", port)
>>> return_dictionary = server_obj.return_last_data()  # This will store the last results so you dont need to query again
# OR
>>> return_dictionary = server_obj.query_game_server() # New results, also saved and can be retrieved via the return_last_data method
>>> return_dictionary
>>> {'online': True, 'ip': 'ip', 'port': port, 'name': 'name', 'map': 'map', 'game': 'game', 'description': 'server desc', 'players': players, 'max_players': slots, 'bots': bots, 'password_required': bool, 'vac_secure': bool, 'server-type': 'type', 'os': 'os'}
>>> return_dictionary["players"]
>>> 10  # Example as the dictionary above just has 'players'

If the server is offline

>>> from steam import SteamQuery
>>> server_obj = SteamQuery("serverip", port)
>>> return_dictionary = server_obj.return_last_data()
>>> return_dictionary
>>> {'online': False, 'error': 'Request timed out'}

Timeout has a default value of 1 second, however a different integer can be passed

>>> from steam import SteamQuery
>>> server_obj = SteamQuery("serverip", port, 2)  # 2 seconds

What it returns

  • online: Boolean
  • ip: String
  • port: Integer
  • name: String
  • map: String
  • game: String
  • description: String
  • players: Integer
  • max_players: Integer
  • bots: Integer
  • password_required: Boolean
  • vac_secure: Boolean
  • server_type: String (Dedicated/Non-Dedicated/SourceTV)
  • os: String (Windows/Linux/Mac)

Note

This was made for python 3 and has no support for python 2

steamquery's People

Contributors

jason2605 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.