Skip to main content

VALVE-Server Queries

✨基于A2S协议,一款可以查询求生服务器状态的库✨

✨Based on the agreement with the Left 4 Dead 2 server, a library that can query the status of the survival server.✨

GitHub stars GitHub issues
## Description说明 目标是实现服务器全链接(1/N)

🎉 available已实现

  • ipv4连接到求生之路2服务器并返回基本信息(A2S_INFO)
  • ipv4连接到求生之路2服务器并返回在线玩家信息(A2S_PLAYER)

📖 to do list可能会做

  • 暂无

👌 pip安装

    pip install VSQ

📖 use使用

函数包括

    # 总信息
    server  (ip : str , port : int , times = 60) -> dict
    ip:ipv4 ,port:端口号 , times 默认为60,也就是说一分钟内同时调用任意函数,服务器将使用第一次的缓存,这可以使得防止被当做DDOS
    # 格式 {'header':xx,'protocol':xxx,...}
    header, protocol, name, map_, folder, game, appid, players, max_players, bots, server_type, environment, visibility, vac, version, edf
    # 分别代表服务器返回的参数

    # 玩家信息
    players (ip : str , port : int , times = 60) -> dict:
    # 格式
    {
    'header':1,
    'Players':
        [{
            'Index':0,
            'Name':xxx,
            'Score':114514,
            'Duration':int but who care
        },
        {
            ...
        }
        ]
    }

🍻 exemple示例代码

如果我想要获取服务器名字/地图/玩家数量
    from VSQ import l4d2
    ip:str = '127.0.0.1' 
    port:int = 20715 
    name = l4d2.name(ip,port)
    map_ = l4d2.map_(ip,port)
    players = await l4d2.players(ip,port)
    print(name)
    print(map_)
    print(players)

如果我想要获取服务器所有信息的字典(所有的键在上面,其中edf是bytes类,后面还有额外的附带信息所以有21个键对,如果有需求可以看源代码
    from VSQ import l4d2
    ip:str = '127.0.0.1' 
    port:int = 20715 
    server_dict = await l4d2.server(ip,port)
    print(server_dict)

    from VSQ import l4d2
    ip:str = '127.0.0.1' 
    port:int = 20715 
    players_data =  await l4d2.players(ip,port)
    players_number = players_data['header']
    for i in players_data['Players'][0]
        print('player_name',i['Name'])

🌐 Communicate with me联系我

email:Z735803792@163.com

Metadata

Release files for vsq 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vsq 0.1.1
File Size Uploaded
vsq-0.1.1.tar.gz 19.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vsq 0.1.1
File Interpreter ABI Platform
vsq-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 52.2 kB

Release files / vsq-0.1.1.tar.gz

Download URL vsq-0.1.1.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c22d82b015efeca920c1c34c29bd44ceeb78ea6e66d475fd192d198637db1c16
BLAKE2b-256 checksum
How to use checksums
84f3804e967811faa16ea937a477a5a222d1e6ae19cf0100792eb6007857a735
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.9.10 Windows/10

Release files / vsq-0.1.1-py3-none-any.whl

Download URL vsq-0.1.1-py3-none-any.whl
Size 32.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0419cee446b0f61e7803d721c93d52041f28c66762e3a32ade81a838a873352
BLAKE2b-256 checksum
How to use checksums
0a0256eade94f0c921fe87feec6a9ad68edf71896ab428a0fefb919c13525e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.9.10 Windows/10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page