Git Product home page Git Product logo

mcstatus's People

Contributors

5igi0 avatar alphabaqpla avatar anna-28 avatar b23r0 avatar christracy avatar coolcat467 avatar damcraft avatar dependabot[bot] avatar dinnerbone avatar fyssion avatar iapetus-11 avatar itsdrike avatar jplusc avatar kevinkjt2000 avatar klemek avatar lgc2333 avatar meruslan avatar pangeacake avatar perchunpak avatar preeded avatar rainerzufall187 avatar scientificworld avatar shoghicp avatar thesadru avatar thewlr9 avatar tjni avatar ulidtko avatar urda avatar winny- avatar zeroflow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mcstatus's Issues

socket.timeout: timed out

RudyB Authored by RudyB
Nov 30, 2015
Closed Nov 30, 2015


Whenever I try to run a query based on a minecraft server IP, I keep getting the error: "socket.timeout: timed out"

Here is the code I am using:
server = MinecraftServer.lookup('mc.charliecraft.com')
query = server.query()
print("The server has the following players online: {0}".format(", ".join(query.players.names)))

Here is the exact error I am getting:

Traceback (most recent call last):
  File "/mcstatus-master/run.py", line 5, in <module>
    query = server.query()
  File "/mcstatus-master/mcstatus/server.py", line 84, in query
    raise exception
  File "/mcstatus-master/mcstatus/server.py", line 79, in query
    querier.handshake()
  File "/mcstatus-master/mcstatus/querier.py", line 32, in handshake
    packet = self._read_packet()
  File "/mcstatus-master/mcstatus/querier.py", line 25, in _read_packet
    packet.receive(self.connection.read(self.connection.remaining()))
  File "/mcstatus-master/mcstatus/protocol/connection.py", line 172, in read
    result.extend(self.socket.recvfrom(self.remaining())[0])
socket.timeout: timed out

Not working after a while.

DerpDays Authored by DerpDays
May 10, 2018
Closed Aug 2, 2018


Exception in command 'players'
Traceback (most recent call last):
  File "C:\Users\gameserver\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 62, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "C:\Users\gameserver\Desktop\Derps-Testing-Droid\cogs\players\players.py", line 20, in players
    ozquery = ozserver.query()
  File "C:\Users\gameserver\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\server.py", line 82, in query
    raise exception
  File "C:\Users\gameserver\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\server.py", line 77, in query
    querier.handshake()
  File "C:\Users\gameserver\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\querier.py", line 30, in handshake
    self.connection.write(self._create_packet(self.PACKET_TYPE_CHALLENGE))
  File "C:\Users\gameserver\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\protocol\connection.py", line 181, in write
    self.socket.sendto(data, self.addr)
socket.gaierror: [Errno 11001] getaddrinfo failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\gameserver\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 886, in invoke
    yield from ctx.command.invoke(ctx)
  File "C:\Users\gameserver\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 514, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\gameserver\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 71, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: gaierror: [Errno 11001] getaddrinfo failed

I got this error after a bit Code:

import discord
from discord.ext import commands
from discord import utils
from mcstatus import MinecraftServer
import asyncio

class players:
    """Get the player count and display the data"""


    @commands.command(name="players")
    async def players(self, ctx):

        dwserver = MinecraftServer.lookup("direwolf.forgottenmc.net:25565")
        dwquery = dwserver.query()
        dwplayers = dwquery.players.online

        djserver = MinecraftServer.lookup("divine.forgottenmc.net:25565")
        djquery = djserver.query()
        djplayers = djquery.players.online

        ozserver = MinecraftServer.lookup("divine.forgottenmc.net:25565")
        ozquery = ozserver.query()
        ozplayers = ozquery.players.online

        vaserver = MinecraftServer.lookup("divine.forgottenmc.net:25565")
        vaquery = vaserver.query()
        vaplayers = vaquery.players.online


        embed = discord.Embed(title="Currently online", description="-----------------------", color=0xffffff)
        embed.add_field(name="Direwolf20: ", value=dwplayers)
        embed.add_field(name="Divine Journey: ", value=djplayers)
        embed.add_field(name="Ozone 2: ", value=ozplayers)
        embed.add_field(name="Vanilla: ", value=vaplayers)
        await ctx.send(embed=embed)


Animated MOTDs result in errors.

dmptrluke Authored by dmptrluke
Mar 17, 2015
Closed May 7, 2019


I know it's not a proper part of the MOTD spec, but a lot of servers now are using "animated" MOTDs. As long as minecraft itself "supports" them, MCStatus should be able to at least get the first frame from an animated MOTD.

recaptcha on dinnerbone serverstatus site not showing up

DoomSquirter Authored by DoomSquirter
May 16, 2018
Closed May 7, 2019


didn't know where else to put this.

got hit with a recaptcha on https://dinnerbone.com/minecraft/tools/status/

tried three different browsers (edge, firefox, pale moon), firefox/edge with no addons.

I get a recaptcha section to prove I'm not a human but no captcha shows up. I see that as of march 31st, 2018, api v1 of recaptcha is no longer working. wondering if this is the reason?
https://developers.google.com/recaptcha/docs/faq

ImportError: cannot import name MinecraftServer

brandonleon Authored by brandonleon
Apr 23, 2018
Closed May 10, 2019


Not sure where to begin troubleshooting this, if this is just an issue with my environment configuration let me know and I can continue to troubleshoot my system.

Trying to execute this in a script results in the same error.

root@Aluminium:/home/bleon# python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mcstatus
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mcstatus.py", line 1, in <module>
    from mcstatus import MinecraftServer
ImportError: cannot import name MinecraftServer
>>> from mcstatus import MinecraftServer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mcstatus.py", line 1, in <module>
    from mcstatus import MinecraftServer
ImportError: cannot import name MinecraftServer
>>>

however, running mcstatus from the command line works:

root@Aluminium:/home/bleon# mcstatus localhost status
version: v1.12.2 (protocol 340)
description: "{u'text': u'A Minecraft Server'}"
players: 0/20 No players online

Python 3.3.2 - TypeError: can't concat bytes to str

taksuyu Authored by taksuyu
Jul 6, 2013
Closed Sep 4, 2014


Traceback (most recent call last):
File "test.py", line 8, in
print("Players: %s" % query.get_status()['numplayers'])
File "/home/tak/git/mcstatus/minecraft_query.py", line 67, in get_status
self.handshake()
File "/home/tak/git/mcstatus/minecraft_query.py", line 48, in handshake
self.send_packet(self.PACKET_TYPE_CHALLENGE)
File "/home/tak/git/mcstatus/minecraft_query.py", line 39, in send_packet
self.send_raw(struct.pack('>B', type) + self.id_packed + self.challenge_packed + data)
TypeError: can't concat bytes to str

Update the pypi build

dmptrluke Authored by dmptrluke
Jan 15, 2015
Closed Jan 24, 2015


The pypi/pip build setup.py still requires Six, meaning it will fail to install unless you separately install Six beforehand

UnicodeEncodeError mcstatus.py", line 83, in query click.echo("motd: \"{}\"".format(response.motd))

Veritas83 Authored by Veritas83
Apr 30, 2017
Closed May 7, 2019


C:\Python27\Scripts>mcstatus mc.nigeltodman.com status
version: v17w17b (protocol 325)
description: "{u'text': u'\xa7l\xa7a[17w17b]\xa7r \xa7eVanilla Survival 1.12 (Snapshot) by \xa7cNigelTodman.com'}"
players: 0/100 No players online
C:\Python27\Scripts>mcstatus mc.nigeltodman.com query
host: mc.nigeltodman.com:25565
software: v17w17b vanilla
plugins: []
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\mcstatus.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\python27\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\mcstatus\scripts\mcstatus.py", line 83, in query
    click.echo("motd: \"{}\"".format(response.motd))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa7' in position 0: ordinal not in range(128)

query() Not functioning

masecla22 Authored by masecla22
Mar 29, 2018
Closed May 7, 2019


I am trying to make a discord bot that pings minecraft servers. This is my code (which just so happens to be the example you provided)
# If you know the host and port, you may skip this and use MinecraftServer("example.org", 1234) server = MinecraftServer("doge.bitquest.co",25565) # 'status' is supported by all Minecraft servers that are version 1.7 or higher. status = server.status() print("The server has {0} players and replied in {1} ms".format(status.players.online, status.latency)) # 'ping' is supported by all Minecraft servers that are version 1.7 or higher. # It is included in a 'status' call, but is exposed separate if you do not require the additional info. latency = server.ping() print("The server replied in {0} ms".format(latency)) # 'query' has to be enabled in a servers' server.properties file. # It may give more information than a ping, such as a full player list or mod information. query = server.query() print("The server has the following players online: {0}".format(", ".join(query.players.names)))

And when I run this i get the following error
The server has 5 players and replied in 416.592 ms The server replied in 374.217 ms Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\super\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "C:\Users\super\Desktop\BOTPY\DogeBit\bot.py", line 104, in on_message query = server.query() File "C:\Users\super\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\server.py", line 82, in query raise exception File "C:\Users\super\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\server.py", line 77, in query querier.handshake() File "C:\Users\super\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\querier.py", line 32, in handshake packet = self._read_packet() File "C:\Users\super\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\querier.py", line 25, in _read_packet packet.receive(self.connection.read(self.connection.remaining())) File "C:\Users\super\AppData\Local\Programs\Python\Python36-32\lib\site-packages\mcstatus\protocol\connection.py", line 175, in read result.extend(self.socket.recvfrom(self.remaining())[0]) socket.timeout: timed out
The server is online, and has the query enabled in it's code.

more docu for installing it

Goten87 Authored by Goten87
Jun 15, 2013
Closed Sep 4, 2014


i want more info on how to install and use this handy tool
sins i dont know how i need to get this to work in my website

Why is the 'motd' called 'hostname' in the raw query output?

urda Authored by urda
Sep 25, 2014
Closed Sep 26, 2014


Consider the following:

from mcstatus import MinecraftServer

server = MinecraftServer.lookup("server.com")
query = server.query()

# query.raw contains:
{u'game_id': u'MINECRAFT',
 u'gametype': u'SMP',
 u'hostip': u'server.com',
 u'hostname': u"MOTD MOTD MOTD HERE",
 u'hostport': u'25565',
 u'map': u'world map',
 u'maxplayers': u'10',
 u'numplayers': u'2',
 u'plugins': u'',
 u'version': u'1.8'}

It's called 'hostname' when it should be titled 'motd' or something similar. Opening this issue now in case I don't patch it right away.

Doesn't respect DNS SRV records

Thue Authored by Thue
Sep 15, 2014
Closed Sep 25, 2014


You can user DNS SRV records to specify the port number Minecraft is running on. This enables you to run multiple servers on the same IP address, using subdomains, with each subdomain using a SRV record to specify the port number. Players then don't have to specify the port number when entering the subdomain address in their MineCraft client.

mcstatus doesn't seem to look up the port number in the SRV record.

Implement or Remove Color Codes

joezimjs Authored by joezimjs
Sep 30, 2014
Closed Jun 17, 2021


If you use this tool on your site and look up play.lichcraft.com, you'll get some interesting text back on what I believe is the MotD:

§9Lichcraft.com §7§kZZ §b§kiiii§6§lVote §4§lDaily §6§lAt §6§llichcraft.com/vote§b§kiiii §7§kZZ

I believe most of that nonsense is formatting codes. You can see what all the codes mean at the bottom of this file: https://github.com/matty/MC-ServerQuery/blob/master/mc_serverquery.js

Better API to query/ping/status

Dinnerbone Authored by Dinnerbone
Sep 17, 2014
Closed Sep 25, 2014


Per #13 (Thanks @urda):
server.ping() - ONLY returns the ping value of the server
server.query() - This gets a full query about the server
server.status() - This gets a quick status about the server (also including ping)

Exception when trying to check the status of a starting server in a while loop

Reviville Authored by Reviville
Jun 17, 2017
Closed May 7, 2019


Hey ho,

as the title already mentions, im trying to check the status of a starting minecraft server using a while-loop with server.status()

My log then shows the following exception:

AttributeError: 'TCPSocketConnection' object has no attribute 'socket' Exception ignored in: <bound method TCPSocketConnection.__del__ of <mcstatus.protocol.connection.TCPSocketConnection object at 0x7fb4005e1e10>> Traceback (most recent call last): File "/path/to/project/.venv/lib/python3.6/site-packages/mcstatus/protocol/connection.py", line 153, in __del__ self.socket.close()

If the server is up, it works. So it works if you request the server a single time, just not when trying to request it several times in a loop.
Any suggestions?

Ping server sends duplicate handshakes

electromatter Authored by electromatter
Aug 20, 2015
Closed Apr 11, 2021


9340ab4 Introduces a bug where handshakes are sent multiple times. This is invalid because the handshakes are not lost, as this is a tcp commection, and this causes an invalid packet to be sent.

server query issue

wiihoffmann Authored by wiihoffmann
Mar 27, 2015
Closed Apr 5, 2015


i am trying to make a python program where i get an email whenever certain people join the server, however when i try to query the server i get this error:

Traceback (most recent call last):
File "D:\Josh\Desktop\test1.py", line 5, in
query = server.query()
File "D:\Programs\python\lib\site-packages\mcstatus\server.py", line 82, in query
raise exception
File "D:\Programs\python\lib\site-packages\mcstatus\server.py", line 77, in query
querier.handshake()
File "D:\Programs\python\lib\site-packages\mcstatus\querier.py", line 32, in handshake
packet = self._read_packet()
File "D:\Programs\python\lib\site-packages\mcstatus\querier.py", line 25, in _read_packet
packet.receive(self.connection.read(self.connection.remaining()))
File "D:\Programs\python\lib\site-packages\mcstatus\protocol\connection.py", line 172, in read
result.extend(self.socket.recvfrom(self.remaining())[0])
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

additional info:
query is enabled in the server.properties
running vanilla minecraft
when using this site http://goo.gl/YRVYIQ i can see who is on the server just fine
i get the error on both my raspberry pi and pc

Add simple CLI For checking server status

audy Authored by audy
May 24, 2015
Closed Apr 1, 2017


I thought it would be useful to add a simple command-line script for checking the status of a server.

Something like:

$ mcstatus server 25599

There are 2 users online.

Can mcstatus be updated to get the server icon?

urda Authored by urda
Feb 1, 2014
Closed Sep 5, 2014


Is it possible for the server protocol to download the icon (server-icon.png) from a minecraft server?

If so, what would need to be added to mcstatus to do such a thing?

No updates?

xorinzor Authored by xorinzor
Nov 29, 2016
Closed Apr 1, 2017


I can see in the contribution history that @Dinnerbone is active on github, yet there are 4 easy to merge pull requests waiting.. what's going on? :/

Cannot pickle mcstatus.pinger.PingResponse

winny- Authored by winny-
Jan 21, 2015
Closed Apr 11, 2021


Hi, I am not entirely certain what is going on here:

Python 3.4.2 (default, Oct 19 2014, 17:52:17)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle, mcstatus
>>> server = mcstatus.MinecraftServer('p.nerd.nu', 25565)
>>> result = server.status()
>>> pickle.dumps(result)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <class 'mcstatus.pinger.PingResponse.Players'>: attribute lookup Players on mcstatus.pinger failed

I originally found this through parallelizing server list pings using the multiprocessing module, with the following error (see the script here: https://gist.github.com/winny-/681fb7f8cf22ee23feb1/5841611b8d7a9d14b962a113c68bb5590834f7a6):

➜  mcstatus-py git:(master) python3 ~/Desktop/ping_servers.py
Traceback (most recent call last):
  File "/Users/winston/Desktop/ping_servers.py", line 98, in <module>
    main()
  File "/Users/winston/Desktop/ping_servers.py", line 80, in main
    for s in ping_servers_async(get_servers()):
  File "/Users/winston/Desktop/ping_servers.py", line 76, in ping_servers_async
    yield from pool.map(ping_server, servers)
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/multiprocessing/pool.py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/multiprocessing/pool.py", line 599, in get
    raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: '[PingResult(server=Server(name='Bytesadism', ip='minecraft.bytesadism.org', port=25565), status=<mcstatus.pinger.PingResponse object at 0x1044e2a90>, error=None)]'. Reason: 'PicklingError("Can't pickle <class 'mcstatus.pinger.PingResponse.Version'>: attribute lookup Version on mcstatus.pinger failed",)'

Socket Timeout

Carlipoot Authored by Carlipoot
Jul 17, 2019
Closed Jul 18, 2019


Hi there. I just installed mcstatus 2.2.1 on my raspberry pi using pip. I can successfully run ping and status on my Minecraft Server (1.14.3) with results. When I run query I get a socket timeout. Below is there error.

$ mcstatus 192.168.1.150 query Traceback (most recent call last):   File "/usr/local/bin/mcstatus", line 11, in <module>     sys.exit(cli())   File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in __call__     return self.main(*args, **kwargs)   File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main     rv = self.invoke(ctx)   File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke     return _process_result(sub_ctx.command.invoke(sub_ctx))   File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke     return ctx.invoke(self.callback, **ctx.params)   File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke     return callback(*args, **kwargs)   File "/usr/local/lib/python2.7/dist-packages/mcstatus/scripts/mcstatus.py", line 79, in query     response = server.query()   File "/usr/local/lib/python2.7/dist-packages/mcstatus/server.py", line 82, in query     raise exception socket.timeout: timed out

Does not work with 1.6.4 or below servers

benaubin Authored by benaubin
Aug 21, 2015
Closed May 7, 2019


Trying to set this up for a group of modded servers I'm developing for. It looks as if I cannot check the status of, or query a 1.6 or below server.

1.7+ Servers work perfectly
1.6 Servers timeout, on both a .status(), and a .query()
1.5 Servers do not respond to either, resulting in a IOError

My test results:

Updating Servers...
   - inf.brierie.co
   - dw20.brierie.co
   - horizons.brierie.net
   - departed.brierie.net
   - cloud9.brierie.co
   - mc.brierie.co
   - monster.brierie.co
     - socket.timeout
   - lite3.brierie.net
   - ultimate.brierie.co
     - IOError
   - horizons.brierie.co
     - socket.timeout
   - tw2.brierie.co
     - socket.timeout
   - regrowth.brierie.net
   - sf2.brierie.net
   - skyblock.brierie.co
   - tppi.brierie.co
     - IOError

Hanging on recieve

tlaundal Authored by tlaundal
Jan 2, 2015
Closed Jan 15, 2015


I have a small daemon that repeatedly gets the status of a list of servers to find out how many players they have online. The deamon is single-threaded and consists mostly of a loop and calls to mcstatus' MinecraftServer.status.

After running for a couple of hours, the daemon suddenly hangs, and the daemon process uses over 90% of the system CPU. The function that does the server calls is decorated by a @timeout_decorator.timeout(30), to prevent the whole app from stopping, but this doesn't work.

This is all running on Ubuntu 14.04.1 LTS, with mcstatus==2.0.

Here is the stack trace from when i do Ctrl + C to kill the daemon:

Traceback (most recent call last):
  File "loader.py", line 22, in <module>
    main()
  File "loader.py", line 13, in main
    do_ping(app, db)
  File "/var/www/PlayerCountGraph/env/src/timeout-decorator/timeout_decorator/timeout_decorator.py", line 46, in new_f
    result = f(*args, **kwargs)
  File "/var/www/PlayerCountGraph/playercountgraph/scheduler.py", line 15, in do_ping
    ping_server(db, server)
  File "/var/www/PlayerCountGraph/playercountgraph/scheduler.py", line 29, in ping_server
    players = new_ping(server)
  File "/var/www/PlayerCountGraph/playercountgraph/scheduler.py", line 45, in new_ping
    .online ## This is really a call like this: MinecraftServer..status().players.online
  File "/var/www/PlayerCountGraph/env/lib/python3.4/site-packages/mcstatus/server.py", line 57, in status
    result = pinger.read_status()
  File "/var/www/PlayerCountGraph/env/lib/python3.4/site-packages/mcstatus/pinger.py", line 34, in read_status
    response = self.connection.read_buffer()
  File "/var/www/PlayerCountGraph/env/lib/python3.4/site-packages/mcstatus/protocol/connection.py", line 115, in read_buffer
    length = self.read_varint()
  File "/var/www/PlayerCountGraph/env/lib/python3.4/site-packages/mcstatus/protocol/connection.py", line 44, in read_varint
    part = ord(self.read(1))
  File "/var/www/PlayerCountGraph/env/lib/python3.4/site-packages/mcstatus/protocol/connection.py", line 143, in read
    result.extend(self.socket.recv(length - len(result)))
KeyboardInterrupt

From the stack trace, it seems the freezing/hanging happens in mcstatus. Is there any fix that could be applied to mcstatus, or a work around I could use?

Exception when trying to use the repository

Jm56Z Authored by Jm56Z
Sep 18, 2017
Closed Sep 18, 2017


I use MacOS Sierra

I downloaded the repository (with git clone https://github.com/Dinnerbone/mcstatus on the command line)
Then I included the few lines told in the main page of this repo in a js file meant to be a discord bot :
from /Users/*********/mcstatus import MinecraftServer;
And I get this error :

from /Users/*********/mcstatus import MinecraftServer;
                               ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:537:28)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module.runMain (module.js:609:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3

I also have the node.js and discord.js files...
Can anyone explain me what this error means ? Being new to coding is quite hard...

How do I implement this in HTML

Riprock Authored by Riprock
May 25, 2016
Closed May 7, 2019


IM making a website and I want to have this in but I don't know how to implement this in. Anyone know how?

Problem installing with pip.

jmhobbs Authored by jmhobbs
Sep 30, 2014
Closed Nov 19, 2014


I just attempted installing with pip, and got a missing module error in setup.py

(env)root@minecraft:/opt/minecraft# pip install mcstatus
Downloading/unpacking mcstatus
  Downloading mcstatus-2.0.zip
  Running setup.py egg_info for package mcstatus
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/opt/minecraft/env/build/mcstatus/setup.py", line 2, in <module>
        from six import PY2
    ImportError: No module named six
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/opt/minecraft/env/build/mcstatus/setup.py", line 2, in <module>

    from six import PY2

ImportError: No module named six

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /opt/minecraft/env/build/mcstatus
Storing complete log in /root/.pip/pip.log

I then installed six by itself, and mcstatus installed fine afterwards.

(env)root@minecraft:/opt/minecraft# pip install six
Downloading/unpacking six
  Downloading six-1.8.0.tar.gz
  Running setup.py egg_info for package six

    no previously-included directories found matching 'documentation/_build'
Installing collected packages: six
  Running setup.py install for six

    no previously-included directories found matching 'documentation/_build'
Successfully installed six
Cleaning up...
(env)root@minecraft:/opt/minecraft# pip install mcstatus
Downloading/unpacking mcstatus
  Downloading mcstatus-2.0.zip
  Running setup.py egg_info for package mcstatus

Requirement already satisfied (use --upgrade to upgrade): six in ./env/lib/python2.7/site-packages (from mcstatus)
Downloading/unpacking dnspython (from mcstatus)
  Downloading dnspython-1.12.0.zip (230kB): 230kB downloaded
  Running setup.py egg_info for package dnspython

Installing collected packages: mcstatus, dnspython
  Running setup.py install for mcstatus

  Running setup.py install for dnspython

Successfully installed mcstatus dnspython
Cleaning up...

My python version says 2.7.5+ (not sure what the + is for)

(env)root@minecraft:/opt/minecraft# python --version
Python 2.7.5+

I'm on Ubuntu 14.04.

How can I get plugins list without versions?

sanjok-bless Authored by sanjok-bless
Jun 2, 2016
Closed May 10, 2019


Now when I check minecraft server with query.software.plugins I get a list with versions:
WorldBorder 1.6.0,MultiWorld 2.9.0,AutomaticPrivates 1,Fix_bugs 0.1,WorldEdit 1141-2ed92da,PlgSetspawn 5.0,CreativeGates 1.4,ColoredSigns 4.1,FullJoinVip 1.0,RandomChestCmd 2.3.0,PlayerServer Information 1.0,PermissionsEx 1.20.4,AntiRelog 2.5.0,TP_RG_kot525 0.1,WorldGuard 5.7.1,OtkatPlagin 0.1,InversionTimeWorld 0.1,FixedIS_kot525 0.1,AutoMessage 2.3.1,iConomy 7.0,bonus_kot525 1,LogKot525 0.1,LokiBlocker 0.5.2,ShoppingRG_kot525 0.1,OpenInv 2.0.8,ChestShop 3.5,FirstJoinPlus 1.8.2,ProtocolLib 3.1.2,AutoSaveWorld 3.6,ProMessage_Kot525 0.1,Essentials 2.9.6,ChatManager 1.19.1,NoCheatPlus 3.11.1-RC-sMD5NET-b743,ChatGuard 5.8

How can I get plugins list without versions? Is it possible?

Check Online

Mepth Authored by Mepth
Sep 17, 2017
Closed May 7, 2019


How can I check if the server is online?

Hiding server player list

Ionaru Authored by Ionaru
Sep 4, 2015
Closed Sep 7, 2015


When using the query on my server, I get the message "Unfortunately, this server is hiding their player list.". All the other information loads normally.
How do I un-hide the player list on my server?

Settings in server.properties:
enable-query=true

Minecraft version:
1.7.10

Time out on 1.8.8 server

Bunkerbewohner Authored by Bunkerbewohner
Sep 15, 2015
Closed May 7, 2019


Hi,

i'm trying to use mcstatus to query the player list of my minecraft server. Unfortunately, no matter what I try, it doesn't work:

Python 2.7.9 (default, Apr  2 2015, 15:33:21) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mcstatus
>>> server = mcstatus.MinecraftServer.lookup(myserverurl)
>>> server
<mcstatus.server.MinecraftServer instance at 0x7f5000eaa560>
>>> server.ping()
69.326
>>> q = server.query()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/mcstatus/server.py", line 82, in query
    raise exception
socket.timeout: timed out

Traceback:

Traceback:
File "/home/mathias/.local/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/mathias/Projects/mclobby/mclobby/views.py" in query
  26.         query = server.query()
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/server.py" in query
  82.             raise exception
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/server.py" in query
  77.                 querier.handshake()
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/querier.py" in handshake
  32.         packet = self._read_packet()
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/querier.py" in _read_packet
  25.         packet.receive(self.connection.read(self.connection.remaining()))
File "/home/mathias/.local/lib/python3.4/site-packages/mcstatus/protocol/connection.py" in read
  172.             result.extend(self.socket.recvfrom(self.remaining())[0])

The calls server.status() and server.ping() work just fine. Also on the example page http://dinnerbone.com/minecraft/tools/status/ I can query my server, presumably using the same code. Any idea what could be the problem?

query() not working

EnderInvader Authored by EnderInvader
Aug 13, 2017
Closed May 7, 2019


I can't get the query() to work.
I have enable-query set to true.
I am just running the example code on the front page.

Traceback (most recent call last): File "C:/Users/User/Desktop/server_status.py", line 17, in <module> query = server.query() File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\mcstatus\server.py", line 82, in query raise exception File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\mcstatus\server.py", line 77, in query querier.handshake() File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\mcstatus\querier.py", line 32, in handshake packet = self._read_packet() File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\mcstatus\querier.py", line 25, in _read_packet packet.receive(self.connection.read(self.connection.remaining())) File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\mcstatus\protocol\connection.py", line 175, in read result.extend(self.socket.recvfrom(self.remaining())[0]) socket.timeout: timed out

Update for 1.7's json response please

blha303 Authored by blha303
Nov 23, 2013
Closed Sep 5, 2014


Hi. Big fan. I'm struggling to use and understand the new server query, and updating this repo would be a huge help with that. Thanks :)

Player list is missing from 'raw' output.

urda Authored by urda
Sep 25, 2014
Closed Sep 26, 2014


Consider the following:

from mcstatus import MinecraftServer

server = MinecraftServer.lookup("server.com")
query = server.query()

# query.raw contains:
{u'game_id': u'MINECRAFT',
 u'gametype': u'SMP',
 u'hostip': u'server.com',
 u'hostname': u"MOTD MOTD MOTD HERE",
 u'hostport': u'25565',
 u'map': u'world map',
 u'maxplayers': u'10',
 u'numplayers': u'2',
 u'plugins': u'',
 u'version': u'1.8'}

There's no player list in the raw output! Opening this issue now in case I don't patch it right away.

UDP socket.timeout: timed out

endoriel21 Authored by endoriel21
Sep 28, 2014
Closed Sep 29, 2014


query = server.query()
Traceback (most recent call last):
  File "", line 1, in 
  File "mcstatus/server.py", line 74, in query
    raise exception
socket.timeout: timed out

The Ping and Status works fine, only the Query not.
When i test the same Adress with https://dinnerbone.com/minecraft/tools/status/, it shows also MOTD, Servericon, Software etc, so the Server is reachable and querys turned on there.

Help

MinerPL Authored by MinerPL
Oct 24, 2018
Closed May 7, 2019


Player list is missing from 'raw' output.

urda Authored by urda
Sep 25, 2014
Closed Sep 26, 2014


Consider the following:

from mcstatus import MinecraftServer

server = MinecraftServer.lookup("server.com")
query = server.query()

# query.raw contains:
{u'game_id': u'MINECRAFT',
 u'gametype': u'SMP',
 u'hostip': u'server.com',
 u'hostname': u"MOTD MOTD MOTD HERE",
 u'hostport': u'25565',
 u'map': u'world map',
 u'maxplayers': u'10',
 u'numplayers': u'2',
 u'plugins': u'',
 u'version': u'1.8'}

There's no player list in the raw output! Opening this issue now in case I don't patch it right away.

Doesn't respect DNS SRV records

Thue Authored by Thue
Sep 15, 2014
Closed Sep 25, 2014


You can user DNS SRV records to specify the port number Minecraft is running on. This enables you to run multiple servers on the same IP address, using subdomains, with each subdomain using a SRV record to specify the port number. Players then don't have to specify the port number when entering the subdomain address in their MineCraft client.

mcstatus doesn't seem to look up the port number in the SRV record.

[Errno 111] Connection refused

AndrewB6 Authored by AndrewB6
Jul 9, 2016
Closed Jul 9, 2016


I get this error after installing it with pip and trying to run "test.py" which is a copy of the usage code.

Traceback (most recent call last):
File "test.py", line 7, in
status = server.status()
File "/home/urbanmc/.local/lib/python2.7/site-packages/mcstatus/server.py", line 49, in status
connection = TCPSocketConnection((self.host, self.port))
File "/home/urbanmc/.local/lib/python2.7/site-packages/mcstatus/protocol/connection.py", line 129, in init
self.socket = socket.create_connection(addr, timeout=timeout)
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
socket.error: [Errno 111] Connection refused

Ports > 32767 do not work

ctian1 Authored by ctian1
Nov 24, 2014
Closed May 7, 2019


If the port used to connect to/lookup a server is not less than or equal to 32767, mcstatus will error.

Traceback:

----> 1 test.status()

C:\Python34\lib\site-packages\mcstatus\server.py in status(self, retries, **kwargs)
     61                 exception = e
     62                 attempt += 1
---> 63         raise exception
     64
     65     def query(self, retries=3):

C:\Python34\lib\site-packages\mcstatus\server.py in status(self, retries, **kwargs)
     54             try:
     55                 pinger = ServerPinger(connection, host=self.host, port=self.port, **kwargs)
---> 56                 pinger.handshake()
     57                 result = pinger.read_status()
     58                 result.latency = pinger.test_ping()

C:\Python34\lib\site-packages\mcstatus\pinger.py in handshake(self)
     22         packet.write_varint(self.version)
     23         packet.write_utf(self.host)
---> 24         packet.write_short(self.port)
     25         packet.write_varint(1)  # Intention to query status
     26

C:\Python34\lib\site-packages\mcstatus\protocol\connection.py in write_short(self, value)
     80
     81     def write_short(self, value):
---> 82         self.write(self._pack("h", value))
     83
     84     def read_ushort(self):

C:\Python34\lib\site-packages\mcstatus\protocol\connection.py in _pack(self, format, data)
     37
     38     def _pack(self, format, data):
---> 39         return struct.pack(">" + format, data)
     40
     41     def read_varint(self):

error: 'h' format requires -32768 <= number <= 32767

ImportError: No module named 'dns'

BenjaminUrquhart Authored by BenjaminUrquhart
Dec 31, 2016
Closed Oct 25, 2017


Using Python 3.4 on Raspberry Pi
When importing the module, I get the following error:

Traceback (most recent call last):
File "/home/pi/Python/conn/mcserver.py", line 1, in
from mcstatus import MinecraftServer
File "/home/pi/Python/conn/mcstatus/init.py", line 1, in
from mcstatus.server import MinecraftServer
File "/home/pi/Python/conn/mcstatus/server.py", line 4, in
import dns.resolver
ImportError: No module named 'dns'

What is the 'dns' module shown here?

Your Site Is Broken

TrendMend Authored by TrendMend
Jun 10, 2019
Closed Jun 17, 2019


Hey there,

Umm I don't really know how to put this, but the mcstatus instance on your website is broken. It only shows up for 1/4 of a second then dissapears. Tested on multiple computers and browsers without any plugins affecting your site.

AttributeError: 'TCPSocketConnection' object has no attribute 'socket'

zacholade Authored by zacholade
Oct 20, 2017
Closed May 7, 2019


Exception ignored in: <bound method TCPSocketConnection.del of <mcstatus.protocol.connection.TCPSocketConnection object at 0x7fb1991eccc0>>
Traceback (most recent call last):
File "/root/Factions-Discord-Bot/Factions-Discord-Bot/mcstatus/protocol/connection.py", line 153, in del
self.socket.close()
AttributeError: 'TCPSocketConnection' object has no attribute 'socket'
Exception ignored in: <bound method TCPSocketConnection.del of <mcstatus.protocol.connection.TCPSocketConnection object at 0x7fb19878e208>>
Traceback (most recent call last):
File "/root/Factions-Discord-Bot/Factions-Discord-Bot/mcstatus/protocol/connection.py", line 153, in del
self.socket.close()
AttributeError: 'TCPSocketConnection' object has no attribute 'socket'

ReferenceError: Recaptcha is not defined (site shows nothing)

EthanHermsey Authored by EthanHermsey
May 24, 2019
Closed May 26, 2019


Heya,

In chrome and firefox, I get the following error in the console. and all elements on the page disappear. I can't run the query check.

recaptcha_ajax.js:1 Failed to load resource: the server responded with a status of 404 ()
angular-recaptcha.min.js:7 Uncaught ReferenceError: Recaptcha is not defined
at angular-recaptcha.min.js:7
angular.js:10573 Error: [$injector:unpr] http://errors.angularjs.org/1.3.0-rc.0/$injector/unpr?p0=vcRecaptchaServiceProvider%20%3C-%20vcRecaptchaService
at angular.js:38
at angular.js:3925
at Object.d [as get] (angular.js:4058)
at angular.js:3930
at d (angular.js:4058)
at Object.e [as invoke] (angular.js:4090)
at B.instance (angular.js:7712)
at angular.js:6991
at r (angular.js:340)
at A (angular.js:6990)

Query consistently times out

invalidCards Authored by invalidCards
Sep 2, 2018
Closed May 7, 2019


Tested on multiple servers both on 1.12 and 1.13, using the command line tool after installing it through pip.

Traceback (most recent call last):
  File "C:\Python27\Scripts\mcstatus-script.py", line 11, in <module>
    load_entry_point('mcstatus==2.2', 'console_scripts', 'mcstatus')()
  File "c:\python27\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "c:\python27\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "c:\python27\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\python27\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python27\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\mcstatus\scripts\mcstatus.py", line 79, in query
    response = server.query()
  File "c:\python27\lib\site-packages\mcstatus\server.py", line 82, in query
    raise exception
socket.timeout: timed out

The ping and status protocols do work as expected, and I am able to join both servers in-game.

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.