bombsimon / hltv-python

📺 HLTV live score implementation with Socket.IO
MIT License
15 stars 3 forks source link

ConnectionError: Unexpected response from server for any url i pass #4

Closed Soulbadguy54 closed 3 years ago

Soulbadguy54 commented 3 years ago

Hello, can you help me with that issue. I get an error:

Traceback (most recent call last):
  File "C:\Users\Fedor\PycharmProjects\odds_scraper\main.py", line 26, in on_startup
    await scrap_hltv_scores()
  File "C:\Users\Fedor\PycharmProjects\odds_scraper\hltv_scraper\hltv_score_scraper.py", line 38, in scrap_hltv_scores
    socket = await ls.socket()
  File "C:\Users\Fedor\PycharmProjects\odds_scraper\hltv_scraper\scorebot\scorebot.py", line 303, in socket
    await sio.connect(self.socket_uri)
  File "C:\Users\Fedor\PycharmProjects\odds_scraper\venv\lib\site-packages\socketio\asyncio_client.py", line 144, in connect
    raise exceptions.ConnectionError(exc.args[0]) from None
socketio.exceptions.ConnectionError: Unexpected response from server

The code is:

async def scrap_hltv_scores():
    ls = Livescore()
    ls.from_url(
        "https://www.hltv.org/matches/2352176/8ballers-vs-hazard-esea-open-season-38-australia"
    )
    ls.on(ls.EVENT_CONNECT, on_connect)
    # ls.on(ls.EVENT_SCOREBOARD, on_scoreboard)
    ls.on(ls.EVENT_ROUND_END, on_round_end)

    socket = await ls.socket()
    feed = asyncio.create_task(socket.wait())
    await feed

I tried to change the socket_uri in Livescore class from https://scorebot-secure.hltv.org to https://scorebot-lb.hltv.org e.t.c from docs but nothing changed, except the fact that previous error changes to socketio.exceptions.ConnectionError: Connection refused by the server What's going wrong?

bombsimon commented 3 years ago

Hey! Thanks for the report!

I tried this yesterday and could easily reproduce. The address is reachable but the connection is not working like before.

I did't have time to troubleshoot but will try to look into this later this weekend!

Soulbadguy54 commented 3 years ago

Hey! Thanks for the report!

I tried this yesterday and could easily reproduce. The address is reachable but the connection is not working like before.

I did't have time to troubleshoot but will try to look into this later this weekend!

I appreciate it. Thx u. Iam waiting for response, coz my development a little bit stucked

bombsimon commented 3 years ago

Fixed in #5, I had to lock this to use websocket.

I haven't used this since my last commit and I'm not completely sure what or when this was changed but this fix works for me.