diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-10 19:14:41 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 19:14:41 +0000 |
commit | 6d0cd2083eddb7d94d39da25d33019df7bbc33da (patch) | |
tree | 599a1c464fdebd341971f6a10afd703cd817ff7f | |
parent | 394b0b2e955fc48352e5acd7f26c70dea5a6601d (diff) |
automatic import of python-mcstatus
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-mcstatus.spec | 287 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 289 insertions, 0 deletions
@@ -0,0 +1 @@ +/mcstatus-10.0.2.tar.gz diff --git a/python-mcstatus.spec b/python-mcstatus.spec new file mode 100644 index 0000000..d635bd6 --- /dev/null +++ b/python-mcstatus.spec @@ -0,0 +1,287 @@ +%global _empty_manifest_terminate_build 0 +Name: python-mcstatus +Version: 10.0.2 +Release: 1 +Summary: A library to query Minecraft Servers for their status and capabilities. +License: Apache-2.0 +URL: https://github.com/py-mine/mcstatus +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/34/13/3127f76ce3acf624d171644c6dd98a32ffa2397d6528b36715216f1a952f/mcstatus-10.0.2.tar.gz +BuildArch: noarch + +Requires: python3-asyncio-dgram +Requires: python3-dnspython + +%description +# <img src="https://i.imgur.com/nPCcxts.png" height=25> MCStatus + +[](https://discord.gg/C2wX7zduxC) + +[](https://pypi.org/project/mcstatus/) +[](https://github.com/py-mine/mcstatus/actions/workflows/validation.yml) +[](https://github.com/py-mine/mcstatus/actions/workflows/tox-test.yml) + +Mcstatus provides an API and command line script to fetch publicly available data from Minecraft servers. Specifically, mcstatus retrieves data by using these protocols: [Server List Ping](https://wiki.vg/Server_List_Ping) and [Query](https://wiki.vg/Query). Because of mcstatus, you do not need to fully understand those protocols and can instead skip straight to retrieving minecraft server data quickly in your own programs. + +## Installation + +Mcstatus is available on [PyPI](https://pypi.org/project/mcstatus/), and can be installed trivially with: + +```bash +python3 -m pip install mcstatus +``` + +## Usage + +### Python API + +#### Java Edition + +```python +from mcstatus import JavaServer + +# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function +# If you know the host and port, you may skip this and use JavaServer("example.org", 1234) +server = JavaServer.lookup("example.org:1234") + +# 'status' is supported by all Minecraft servers that are version 1.7 or higher. +# Don't expect the player list to always be complete, because many servers run +# plugins that hide this information or limit the number of players returned or even +# alter this list to contain fake players for purposes of having a custom message here. +status = server.status() +print(f"The server has {status.players.online} player(s) online and replied in {status.latency} ms") + +# 'ping' is supported by all Minecraft servers that are version 1.7 or higher. +# It is included in a 'status' call, but is also exposed separate if you do not require the additional info. +latency = server.ping() +print(f"The server replied in {latency} ms") + +# 'query' has to be enabled in a server's server.properties file! +# It may give more information than a ping, such as a full player list or mod information. +query = server.query() +print(f"The server has the following players online: {', '.join(query.players.names)}") +``` + +#### Bedrock Edition + +```python +from mcstatus import BedrockServer + +# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function +# If you know the host and port, you may skip this and use BedrockServer("example.org", 19132) +server = BedrockServer.lookup("example.org:19132") + +# 'status' is the only feature that is supported by Bedrock at this time. +# In this case status includes players_online, latency, motd, map, gamemode, and players_max. (ex: status.gamemode) +status = server.status() +print(f"The server has {status.players_online} players online and replied in {status.latency} ms") +``` + +### Command Line Interface + +This only works with Java servers; Bedrock is not yet supported. Use `mcstatus -h` to see helpful information on how to use this script. + +## License + +Mcstatus is licensed under the Apache 2.0 license. See LICENSE for full text. + + +%package -n python3-mcstatus +Summary: A library to query Minecraft Servers for their status and capabilities. +Provides: python-mcstatus +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-mcstatus +# <img src="https://i.imgur.com/nPCcxts.png" height=25> MCStatus + +[](https://discord.gg/C2wX7zduxC) + +[](https://pypi.org/project/mcstatus/) +[](https://github.com/py-mine/mcstatus/actions/workflows/validation.yml) +[](https://github.com/py-mine/mcstatus/actions/workflows/tox-test.yml) + +Mcstatus provides an API and command line script to fetch publicly available data from Minecraft servers. Specifically, mcstatus retrieves data by using these protocols: [Server List Ping](https://wiki.vg/Server_List_Ping) and [Query](https://wiki.vg/Query). Because of mcstatus, you do not need to fully understand those protocols and can instead skip straight to retrieving minecraft server data quickly in your own programs. + +## Installation + +Mcstatus is available on [PyPI](https://pypi.org/project/mcstatus/), and can be installed trivially with: + +```bash +python3 -m pip install mcstatus +``` + +## Usage + +### Python API + +#### Java Edition + +```python +from mcstatus import JavaServer + +# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function +# If you know the host and port, you may skip this and use JavaServer("example.org", 1234) +server = JavaServer.lookup("example.org:1234") + +# 'status' is supported by all Minecraft servers that are version 1.7 or higher. +# Don't expect the player list to always be complete, because many servers run +# plugins that hide this information or limit the number of players returned or even +# alter this list to contain fake players for purposes of having a custom message here. +status = server.status() +print(f"The server has {status.players.online} player(s) online and replied in {status.latency} ms") + +# 'ping' is supported by all Minecraft servers that are version 1.7 or higher. +# It is included in a 'status' call, but is also exposed separate if you do not require the additional info. +latency = server.ping() +print(f"The server replied in {latency} ms") + +# 'query' has to be enabled in a server's server.properties file! +# It may give more information than a ping, such as a full player list or mod information. +query = server.query() +print(f"The server has the following players online: {', '.join(query.players.names)}") +``` + +#### Bedrock Edition + +```python +from mcstatus import BedrockServer + +# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function +# If you know the host and port, you may skip this and use BedrockServer("example.org", 19132) +server = BedrockServer.lookup("example.org:19132") + +# 'status' is the only feature that is supported by Bedrock at this time. +# In this case status includes players_online, latency, motd, map, gamemode, and players_max. (ex: status.gamemode) +status = server.status() +print(f"The server has {status.players_online} players online and replied in {status.latency} ms") +``` + +### Command Line Interface + +This only works with Java servers; Bedrock is not yet supported. Use `mcstatus -h` to see helpful information on how to use this script. + +## License + +Mcstatus is licensed under the Apache 2.0 license. See LICENSE for full text. + + +%package help +Summary: Development documents and examples for mcstatus +Provides: python3-mcstatus-doc +%description help +# <img src="https://i.imgur.com/nPCcxts.png" height=25> MCStatus + +[](https://discord.gg/C2wX7zduxC) + +[](https://pypi.org/project/mcstatus/) +[](https://github.com/py-mine/mcstatus/actions/workflows/validation.yml) +[](https://github.com/py-mine/mcstatus/actions/workflows/tox-test.yml) + +Mcstatus provides an API and command line script to fetch publicly available data from Minecraft servers. Specifically, mcstatus retrieves data by using these protocols: [Server List Ping](https://wiki.vg/Server_List_Ping) and [Query](https://wiki.vg/Query). Because of mcstatus, you do not need to fully understand those protocols and can instead skip straight to retrieving minecraft server data quickly in your own programs. + +## Installation + +Mcstatus is available on [PyPI](https://pypi.org/project/mcstatus/), and can be installed trivially with: + +```bash +python3 -m pip install mcstatus +``` + +## Usage + +### Python API + +#### Java Edition + +```python +from mcstatus import JavaServer + +# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function +# If you know the host and port, you may skip this and use JavaServer("example.org", 1234) +server = JavaServer.lookup("example.org:1234") + +# 'status' is supported by all Minecraft servers that are version 1.7 or higher. +# Don't expect the player list to always be complete, because many servers run +# plugins that hide this information or limit the number of players returned or even +# alter this list to contain fake players for purposes of having a custom message here. +status = server.status() +print(f"The server has {status.players.online} player(s) online and replied in {status.latency} ms") + +# 'ping' is supported by all Minecraft servers that are version 1.7 or higher. +# It is included in a 'status' call, but is also exposed separate if you do not require the additional info. +latency = server.ping() +print(f"The server replied in {latency} ms") + +# 'query' has to be enabled in a server's server.properties file! +# It may give more information than a ping, such as a full player list or mod information. +query = server.query() +print(f"The server has the following players online: {', '.join(query.players.names)}") +``` + +#### Bedrock Edition + +```python +from mcstatus import BedrockServer + +# You can pass the same address you'd enter into the address field in minecraft into the 'lookup' function +# If you know the host and port, you may skip this and use BedrockServer("example.org", 19132) +server = BedrockServer.lookup("example.org:19132") + +# 'status' is the only feature that is supported by Bedrock at this time. +# In this case status includes players_online, latency, motd, map, gamemode, and players_max. (ex: status.gamemode) +status = server.status() +print(f"The server has {status.players_online} players online and replied in {status.latency} ms") +``` + +### Command Line Interface + +This only works with Java servers; Bedrock is not yet supported. Use `mcstatus -h` to see helpful information on how to use this script. + +## License + +Mcstatus is licensed under the Apache 2.0 license. See LICENSE for full text. + + +%prep +%autosetup -n mcstatus-10.0.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-mcstatus -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 10.0.2-1 +- Package Spec generated @@ -0,0 +1 @@ +ecb986065d3e066f4dd80bf826763638 mcstatus-10.0.2.tar.gz |