- Notifications
You must be signed in to change notification settings - Fork7
Python library designed for querying game servers. It supports 24 different query protocols and has been downloaded over 34,000 times.
License
opengsq/opengsq-python
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The OpenGSQ Python library provides a convenient way to query serversfrom applications written in the Python language.
The library supports a wide range of protocols. Here are some examples:
fromopengsq.protocolsimport (ASE,Battlefield,Doom3,EOS,FiveM,GameSpy1,GameSpy2,GameSpy3,GameSpy4,Kaillera,KillingFloor,Minecraft,Nadeo,Palworld,Quake1,Quake2,Quake3,RakNet,RenegadeX,Samp,Satisfactory,Scum,Source,TeamSpeak3,Toxikk,UDK,Unreal2,UT3,Vcmp,WON,)
- Python 3.7 or higher
The recommended installation method is usingpip:
pip install --upgrade opengsq
Here’s an example of how to query a server using the Source protocol:
importasynciofromopengsq.protocolsimportSourceasyncdefmain():source=Source(host='45.147.5.5',port=27015)info=awaitsource.get_info()print(info)asyncio.run(main())
You can also use the Source Remote Console:
importasynciofromopengsq.exceptionsimportAuthenticationExceptionfromopengsq.rcon_protocols.source_rconimportSourceRconasyncdefmain():withSourceRcon("123.123.123.123",27015)assource_rcon:try:awaitsource_rcon.authenticate("serverRconPassword")exceptAuthenticationException:print('Failed to authenticate')response=awaitsource_rcon.send_command("cvarlist")print(response)asyncio.run(main())
This library additionally provides anopengsq
command-line utilitywhich makes it easy to query game servers from your terminal. Runopengsq -h
for usage.
# query server using source protocolopengsqsource --host 123.123.123.123 --port 27015 --function get_info
You can find information about tests and results athttps://python.opengsq.com/tests/protocols
Contributions are welcome! Please feel free to submit pull requests or open issues.
About
Python library designed for querying game servers. It supports 24 different query protocols and has been downloaded over 34,000 times.