nekitdev / gd.py

An API Wrapper for Geometry Dash written in Python.
https://nekitdev.github.io/gd.py
MIT License
121 stars 15 forks source link

function get_daily() not working. When Moving the GameVersion over to 2.2 the API Breaks #207

Open CallocGD opened 1 month ago

CallocGD commented 1 month ago

Here's the steps to reproduce this bug

Step 1

pip install gd.py aiounittest

Step 2

# test.py
import aiounittest
import unittest
import gd

class TestDaily(aiounittest.AsyncTestCase):

    @property
    def client(self) -> gd.Client:
        if not hasattr(self, "_client"):
            self._client = gd.Client()
        return self._client

    async def test_get_daily(self):
        daily = await self.client.get_daily()

# This was my idea to try and fix the problem it got the level but failed to parse it.
class TestDailyWith22(aiounittest.AsyncTestCase):
    @property
    def client(self) -> gd.Client:
        if not hasattr(self, "_client"):
            self._client = gd.Client(session=gd.Session(http=gd.HTTPClient(game_version=GameVersion(2,2), binary_version=RobTopVersion(4, 0))))
        return self._client

    async def test_get_daily(self):
        await self.client.get_daily()

if __name__ == "__main__":
    unittest.main()

Step 3

python test.py

If all was done correctly it throws this error no matter what even if there is supposed to be a new daily level out it still breaks. I cannot seem to decipher what was programmed for parsing the level data but even when moving the GameVersion to 2.2 it says it cannot parse the list of numbers and merely assumes it's an integer when it's not. gd.errors.MissingAccess: can not get level with ID: -1

CallocGD commented 1 month ago

@nekitdev I would also recommend you write a test-suite for gdpy as well as that you'll able to easily verify if or when something fails, however if you do not have the time to do so I would be more than happy to write more of these test-cases so that you will be able to confirm and fix these mistakes more easily.

CallocGD commented 1 month ago

Also I am using python 3.9.18 so this testcase should work on most versions if not all of the supported versions of python.