Skip to main content

Asynchronous wrapper for source query.

Project description

GitHub issues GitHub license Actions Status

Install

  • Pypi: pip3 install aioquery
  • Git: pip3 install git+https://github.com/WardPearce/aioquery.git

API

import aioquery
import asyncio


server = aioquery.client("216.52.148.47")


async def test():
    details = await server.info()
    print(
        details.protocol,
        details.hostname,
        details.map,
        details.game_dir,
        details.game_desc,
        details.app_id,
        details.players,
        details.max_players,
        details.bots,
        details.password,
        details.secure,
        details.version,
        details.game_port,
        details.steamid,
        details.spec_port,
        details.spec_name,
        details.tags,
        sep="\n"
    )

    # tags may be None instead of a list.

    if details.dedicated.dedicated:
        print("Dedicated")
    elif details.dedicated.listen:
        print("Listen")
    else:
        print("Source Tv")

    if details.os.windows:
        print("Windows")
    elif details.os.linux:
        print("Linux")
    else:
        print("Mac")

    async for player in server.players():
        print(
            player.name,
            player.id,
            player.frags,
            player.time,
            sep="\n"
        )


loop = asyncio.get_event_loop()
loop.run_until_complete(test())

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

aioquery-1.0.0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

aioquery-1.0.0-py3-none-any.whl (8.7 kB view hashes)

Uploaded Python 3

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