Coder Social home page Coder Social logo

gd.py's Introduction

Discord Keybase Telegram Funding

Building awesome software.

Nikita Tikhonov, 19-year-old software developer from Moscow, Russia.

CEO of MelodyKit, INFP, he/they.

Resume

You can find my resume here.

gd.py's People

Contributors

bswck avatar camila314 avatar dependabot[bot] avatar jouca avatar kifilterfibercontext avatar melowody avatar nekitdev avatar scottwedge avatar spookybear0 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  avatar  avatar  avatar

gd.py's Issues

Add fastapi and lxml requirements when installing gd.py using pip

I am using Python 3.10.5. When I have installed gd.py using this command:

pip install gd.py

I found that I need to install fastapi when import it, like this:

>>> import gd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<PROJECT_PATH>\venv\lib\site-packages\gd\__init__.py", line 11, in <module>
    from gd import (
  File "<PROJECT_PATH>\venv\lib\site-packages\gd\server\__init__.py", line 1, in <module>
    from gd.server.artists import get_artists
  File "<PROJECT_PATH>\venv\lib\site-packages\gd\server\artists.py", line 3, in <module>
    from fastapi import Depends
ModuleNotFoundError: No module named 'fastapi'

After installing fastapi, I have another error:

>>> import gd
failed to import `lxml`; large portion of `newgrounds` functionality is not going to work

It would be better if fastapi and lxml dependencies are installed too after the first command.

Periodic collapse

Let's collapse the history for this and previous years. We can make a tag to save the history.

Possible NULL bytes need to be handled in save parsing.

I put in the code to load local levels(from the docs)

database = gd.api.save.load()

When I try, I get the following error stack:

Traceback (most recent call last):
  File "c:\Users\ender\Documents\codingprojects\mov2gd\edit.py", line 40, in <module>
    db = gd.api.save.load()
         ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\site-packages\gd\api\save_manager.py", line 119, in load
    return self.load_parts(main_data, levels_data, apply_xor=True, follow_system=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\site-packages\gd\api\save_manager.py", line 145, in load_parts
    return self.database_type.load_parts(main, levels)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\site-packages\gd\api\database\database.py", line 294, in load_parts
    main_payload = parser.load(main)
                   ^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\site-packages\gd\plist.py", line 90, in load
    plist = from_string(string)
            ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ender\AppData\Local\Programs\Python\Python311\Lib\xml\etree\ElementTree.py", line 1338, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: reference to invalid character number: line 1, column 10250471

It could be something with my save but I have no idea how to fix it

Unable to install the development build

Running pip install https://github.com/NeKitDS/gd.py/archive/master.zip yields this error:

Building wheels for collected packages: gd-py
  Building wheel for gd-py (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for gd-py (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [38 lines of output]
      Traceback (most recent call last):
        File "E:\.Projects\.GDAI\gd.py-main\build.py", line 87, in <module>
          def main() -> None:
        File "C:\Users\User\AppData\Local\Temp\pip-build-env-v_tocymm\overlay\Lib\site-packages\entrypoint\core.py", line 41, in __call__
          return self.call(main)
        File "C:\Users\User\AppData\Local\Temp\pip-build-env-v_tocymm\overlay\Lib\site-packages\entrypoint\core.py", line 36, in call
          main()
        File "E:\.Projects\.GDAI\gd.py-main\build.py", line 88, in main
          build({})  # type: ignore
        File "E:\.Projects\.GDAI\gd.py-main\build.py", line 57, in build
          result = call(build_command(output_path))
        File "e:\python39\lib\subprocess.py", line 349, in call
          with Popen(*popenargs, **kwargs) as p:
        File "e:\python39\lib\subprocess.py", line 951, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "e:\python39\lib\subprocess.py", line 1420, in _execute_child
          hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
      FileNotFoundError: [WinError 2] The system cannot find the file specified
      Traceback (most recent call last):
        File "e:\python39\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "e:\python39\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "e:\python39\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "C:\Users\User\AppData\Local\Temp\pip-build-env-v_tocymm\overlay\Lib\site-packages\poetry\core\masonry\api.py", line 57, in build_wheel
          return WheelBuilder.make_in(
        File "C:\Users\User\AppData\Local\Temp\pip-build-env-v_tocymm\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 88, in make_in
          wb.build(target_dir=directory)
        File "C:\Users\User\AppData\Local\Temp\pip-build-env-v_tocymm\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 123, in build
          self._build(zip_file)
        File "C:\Users\User\AppData\Local\Temp\pip-build-env-v_tocymm\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 172, in _build
          self._run_build_script(self._package.build_script)
        File "C:\Users\User\AppData\Local\Temp\pip-build-env-v_tocymm\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 232, in _run_build_script
          subprocess.check_call([self.executable.as_posix(), build_script])
        File "e:\python39\lib\subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['e:/python39/python.exe', 'build.py']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for gd-py
Failed to build gd-py
ERROR: Could not build wheels for gd-py, which is required to install pyproject.toml-based projects

Refactor client

Move main coroutines to session.py file, and call them from client.py/user.py. This way, no circular dependencies can occur.

No message when getting a song if newgrounds is down.

The Problem

When you try to get a song with this library, if newgrounds is down, it returns with nothing,

The Ideal Solution

Make it print something if newgrounds is down or not so the user doesn't get confused.

The Current Solution

There is non right now.

Modernize typing

Migrate to PEP 585 and PEP 604 with the help of __future__.annotations.

`use_custom_song` doesn't work

Have a look at this code:

client = gd.Client()

levels = await client.search_levels(
    filters = gd.Filters(
        song_id = 1,
        use_custom_song = True
    )
)

print(levels)

Documentation suggested that use_custom_song is a filter option to treat song id as a custom song id, but result shows levels with "Stereo Madness" song instead of those with "Chilled 1" song (song with ID equal 1).

gd.py version: 0.11.0

X position checking not working

I am making an ai.

The desired result is that when I die in gd, the program saves that place and when I get to a bit before that place, say "yes", but the print('yes') does not run, nor does anything else I put in the if statement.

My code is:

import math
import time
import gd
import jump

    
Math = math
player = gd.memory.get_memory()
listp = []

while 1:
    if player.is_dead():
        listp.append(Math.floor(player.x_pos))
    try:
        if Math.floor(player.x_pos) + 4 in listp:
            print('yes')
    except:
        pass
    

Merge gd.py and gd.api

Since gd.api is essentially just a wrapper around gd.py's system, we could integrate it into gd.py itself.
I propose to either create a new subpackage, or add a new module; named simply server. This way, people could do something like:

import gd
gd.server.start()

Uncaught UnicodeDecodeError in search_levels

Retrieve info about a level whose song contains characters that utf-8 can not decode results in an uncaught exception:

Traceback (most recent call last):
  File "/MyVenv/lib/python3.11/site-packages/IPython/core/interactiveshell.py", line 3526, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-6525e70c27b8>", line 1, in <module>
    runfile('/MyCodebase/main.py', wdir='/MyCodebase')
  File "/MyPyCharm/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/MyPyCharm/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/MyCodebase/main.py", line 12, in <module>
    asyncio.run(main())
  File "/MyVenv/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/MyVenv/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/MyVenv/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/MyCodebase/main.py", line 8, in main
    async for result in levels:
  File "/MyVenv/lib/python3.11/site-packages/iters/async_iters.py", line 984, in __anext__
    return await async_next_unchecked(self.iterator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/MyVenv/lib/python3.11/site-packages/iters/async_utils.py", line 669, in async_next_unchecked
    return await standard_async_next(iterator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/MyVenv/lib/python3.11/site-packages/async_extensions/standard.py", line 36, in async_next
    return await async_iterator.__anext__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/GdPyCodebase/gd/run_iterables.py", line 29, in run_iterables
    raise error
  File "/MyVenv/lib/python3.11/site-packages/async_extensions/collect.py", line 36, in append_tagged_result
    result = Ok(await awaitable)
                ^^^^^^^^^^^^^^^
  File "/MyVenv/lib/python3.11/site-packages/iters/async_utils.py", line 549, in async_list
    return [item async for item in async_iter(iterable)]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/MyVenv/lib/python3.11/site-packages/iters/async_utils.py", line 549, in <listcomp>
    return [item async for item in async_iter(iterable)]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/GdPyCodebase/gd/client.py", line 715, in search_levels_on_page
    response_model = await self.session.search_levels_on_page(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/GdPyCodebase/gd/session.py", line 264, in search_levels_on_page
    response = await self.http.search_levels_on_page(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/GdPyCodebase/gd/http.py", line 1337, in search_levels_on_page
    response = await self.request_route(route, data=payload, error_codes=error_codes)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/GdPyCodebase/gd/http.py", line 696, in request_route
    return await self.request(  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/GdPyCodebase/gd/http.py", line 825, in request
    response_data = await response.text()
                    ^^^^^^^^^^^^^^^^^^^^^
  File "/MyVenv/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1148, in text
    return self._body.decode(  # type: ignore[no-any-return,union-attr]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xab in position 3625: invalid start byte

GD just ignores the error and displays an empty string.
image

Set the players colour

How do you set the users colour in the middle of a level.

Could create a rainbow effect or something...

Найти смещение камеры

Привет, мне нужно найти смещение камеры по Y, чтобы правильно отрисовать игрока по позиции.
Для примера, я сделал небольшой скрипт (для разрешения 640x480 в окне):

import gd.memory
import ctypes
import win32gui, win32ui
a = gd.memory.get_memory()

def winEnumHandler(hwnd, ctx):
    global wnd
    if win32gui.IsWindowVisible(hwnd):
        wnd_text = win32gui.GetWindowText(hwnd)
        if wnd_text == 'Geometry Dash' or wnd_text == 'Geometry Dash Local Multiplayer':
            wnd = hwnd

win32gui.EnumWindows(winEnumHandler, None)

b=(0, 0)

a.player_lock_jump_rotation()

dc = win32gui.GetDC(0)
dcObj = win32ui.CreateDCFromHandle(dc)

rect = win32gui.GetWindowRect(wnd)
wx = rect[0]
wy = rect[1]
ww = rect[2] - wx
wh = rect[3] - wy

px = 8
py = 35

while True:
    ctypes.windll.kernel32.SetConsoleTitleW(f'{a.level_length}, {wx}, {wy}, {ww}, {wh}')
    if not b[0] == a.x_pos or not b[1] == a.y_pos:
        b = (a.x_pos, a.y_pos)
        print(b)
        x = int(b[0] * 0.001) + 200
        y = a.resolution[1] - int(b[1])
        dcObj.Rectangle((wx - px + x, wy - py + y, wx - px + x+40, wy - py + y+40))

Он работает почти нормально:
image1
Но когда камера уходит вверх:
image2
Есть ли способ найти значение, на которое сместилась камера, или просто какую-то закономерность?

(Я нуб в ГД)

Module 'gd' has no 'memory' member

I was trying to run some example code from the repository, but it seems like gd doesn't contain the "memory" member? Please tell me how to fix this, I'm not that new to python but I still don't know how to fix this issue.

Also "Module 'gd.api' has no 'LevelType' member"

image

Refactor `pyproject.toml`

  • Fix version specs (use semver-safe ^ instead of >=)
  • Make test, format and check groups non-optional

Level.updated_at and Level.created_at reports current time, not the correct time

Just before getting into the details, I want to say that this is being tested on the 2.2 GDPS, however is still a bug with gd.py as GDBrowser report the real creation time.

When testing ID 7, the creation time is reported as today at the exact second that the level data was downloaded. This is incorrect, as GDBrowser reports that it was created in 2021

Can I get death?

Hello, can I get death (don't see this function at documentation)?

'Song' Has no attribute 'artist'

`import asyncio

import gd

SONG_ID = 1081309
SONG = "{} by {} (ID: {}, size: {} MB)"

async def main() -> None:
client = gd.Client()
song = await client.get_song(SONG_ID)
print(SONG.format(song.name, song.artist.name, song.id, song.size))

asyncio.run(main())`

403 when calling getGJUsers20.php

Summary

await self.gd_client.find_user(player_name) => gd.errors.HTTPError: Failed to process HTTP request. Caused by: Error<ClientResponseError>(403, message='Forbidden', url=URL('http://www.boomlings.com/database/getGJUsers20.php'))

Traceback

Traceback (most recent call last):
  File "main_logic.py", line 333, in reply_to_vk_message
    await self.vk_worker.reply(await self.handle_command(
  File "main_logic.py", line 301, in handle_command
    handling_result: HandlingResult = await command_.handler(
  File "/home/ubuntu/GDL/handlers/handlers.py", line 163, in get_player_info
    await self.gd_worker.get_player(player_name)
  File "/home/ubuntu/GDL/requests_workers/gd_worker.py", line 17, in get_player
    player = await self.gd_client.find_user(player_name)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/gd/client.py", line 558, in find_user
    data = await self.session.search_user(query, return_abstract=True)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/gd/session.py", line 221, in search_user
    resp = await self.http.request(Route.USER_SEARCH, payload, error_codes=codes)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/gd/utils/http_request.py", line 280, in request
    resp = await self.fetch(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/gd/utils/http_request.py", line 201, in fetch
    raise HTTPError(exc) from None
gd.errors.HTTPError: Failed to process HTTP request. Caused by: Error<ClientResponseError>(403, message='Forbidden', url=URL('http://www.boomlings.com/database/getGJUsers20.php'))

My code

https://github.com/megahomyak/GDL/blob/c19b8d4ca770cf2885fb38e4eca834ab2b42bf14/requests_workers/gd_worker.py#L17

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

System Information

  • python v3.8.5-final
  • gd.py v0.11.0-final
  • aiohttp v3.7.2
  • click v7.1.2
  • system Windows 10 10.0.19041

Rewrite f-strings into str.format()

This is required to support versions from 3.5 and further, since f-strings were introduced in 3.6 (too bad of me thinking they were already in from 3.5)

Fix attribute errors and name errors

Even if there's no implementation yet, let's keep type checking audits usable.

Let's fill in missing interfaces for the ongoing v2 implementation.

Uncaught exception in decoding

decode_base64_url_safe and similar functions throw uncaught decoding exceptions when the data can't be decoded. There is one case when it happens when getting level info: description of the level with id 296.
image
image
Throwing exceptions is not necessarily wrong by itself, but these functions are used inside the library in methods (search_levels for example) that should not throw decoding exceptions when it can be easily avoided by ignoring the unknown bytes.

HTTP Error.

Summary

I was trying to make a bot and i wanted to add a feature to it which gives information about Geometry Dash, unfortunately this pops whenever i try to run in, but the same code works on another device, no changes at all.

Results

Traceback (most recent call last):
File "main.py", line 4, in
print(botGD.level(23262780))
File "/home/runner/PelasePlsae/botGD.py", line 44, in level
return client.run(get_level_info(ID))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/gd/client.py", line 2322, in run
return utils.run(coro, loop=self.loop, debug=debug)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/gd/utils/_async.py", line 197, in run
return loop.run_until_complete(coro)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/runner/PelasePlsae/botGD.py", line 6, in get_level_info
await client.login('', '')
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/gd/client.py", line 724, in login
account_id, player_id = await self.session.login(user=user, password=password)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/gd/session.py", line 492, in login
resp = await self.http.request(Route.LOGIN, payload, error_codes=codes)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/gd/utils/http_request.py", line 266, in request
resp = await self.fetch(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/gd/utils/http_request.py", line 189, in fetch
raise HTTPError(exc) from None
gd.errors.HTTPError: Failed to process HTTP request. Caused by: (Cannot connect to host www.boomlings.com:80 ssl:default [Connect call failed ('162.216.16.96', 80)])

Allow private server usage in Client.

It looks like there aren't many ways to set a custom request URL (without modifying the library itself), which could help with tools targeting private GD servers.

Question

What library gd.py use to get requests from the gd server?

Is it requests, aiohttp, or something else?

Bad examples

When you try to run the example from the memory folder or api, you get an error that says "the GD module does not have the memory attribute".

[to_do] List of things to be done.

[1] Refactor code in terms of readability and style.
[2] Add listening to gd servers.
[3] Implement getting comments and sending friend requests for User, and get_friends, get_friend_requests, get_messages for Client.
[4] Finish graphics module, with huge refactoring.
[5] Add more functionality.

gd.errors.HTTPStatusError: 403 when using `Client.login()` on Python 3.10.12

I haven't been able to connect to my GD account using the library in my VPS. I'm 100% sure the credentials are correct. I should also say that I am able to connect from my own computer, and the issue only happens on my VPS. I tried both the pip and the last repo version. My computer (where it works) is running Python 3.9.7, while my VPS is running 3.10.12, so it may be related to that.

The section of the code I'm using to connect is this one. Since I'm using this for a Discord bot, I also made sure to disable the Discord bot login to avoid any possible conflicts, but it still doesn't work.

I suppose if the actual server is returning 403, maybe it could also be related to CloudFlare or something related to my IP? Although I haven't used this library before, and I haven't ever connected to GD servers on my VPS either.

bot.gd = gd.Client()

async def main():
    async with bot:
        await bot.gd.login(account_name, passwords.gd_password()) # gd.py login

asyncio.run(main())

And this is the error I'm getting:

Traceback (most recent call last):
  File "/home/ubuntu/NoetherBot/bot.py", line 229, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/ubuntu/NoetherBot/bot.py", line 226, in main
    await bot.gd.login(account_name, passwords.gd_password()) # gd.py login
  File "/home/ubuntu/.local/lib/python3.10/site-packages/gd/client.py", line 1881, in login
    await self.client.try_login(self.name, self.password)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/gd/client.py", line 295, in try_login
    model = await self.session.login(name, password)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/gd/session.py", line 100, in login
    response = await self.http.login(name, password)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/gd/http.py", line 923, in login
    response = await self.request_route(route, data=payload, error_codes=error_codes)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/gd/http.py", line 696, in request_route
    return await self.request(  # type: ignore
  File "/home/ubuntu/.local/lib/python3.10/site-packages/gd/http.py", line 859, in request
    raise error
gd.errors.HTTPStatusError: 403

"FileNotFoundError: No such file or directory: "poetry"" while building gd.py

Hello, I'm trying to install gd.py but it gaves the following error:

Building wheels for collected packages: gd.py, xor-cipher
  Building wheel for gd.py (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /tmp/tmpntpk9edj build_wheel /tmp/tmp_sh3uzx5
       cwd: /tmp/pip-install-upezismm/gd.py
  Complete output (38 lines):
  Traceback (most recent call last):
    File "build.py", line 87, in <module>
      def main() -> None:
    File "/tmp/pip-build-env-g1xfycao/overlay/lib/python3.8/site-packages/entrypoint/core.py", line 41, in __call__
      return self.call(main)
    File "/tmp/pip-build-env-g1xfycao/overlay/lib/python3.8/site-packages/entrypoint/core.py", line 36, in call
      main()
    File "build.py", line 88, in main
      build({})  # type: ignore
    File "build.py", line 57, in build
      result = call(build_command(output_path))
    File "/usr/lib/python3.8/subprocess.py", line 340, in call
      with Popen(*popenargs, **kwargs) as p:
    File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
    File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'poetry'
  Traceback (most recent call last):
    File "/tmp/tmpntpk9edj", line 280, in <module>
      main()
    File "/tmp/tmpntpk9edj", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tmpntpk9edj", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-g1xfycao/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 57, in build_wheel
      return WheelBuilder.make_in(
    File "/tmp/pip-build-env-g1xfycao/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 87, in make_in
      wb.build(target_dir=directory)
    File "/tmp/pip-build-env-g1xfycao/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 122, in build
      self._build(zip_file)
    File "/tmp/pip-build-env-g1xfycao/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 171, in _build
      self._run_build_script(self._package.build_script)
    File "/tmp/pip-build-env-g1xfycao/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 231, in _run_build_script
      subprocess.check_call([self.executable.as_posix(), build_script])
    File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/bin/python3', 'build.py']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for gd.py

I have installed rustc, lxml, fastapi, and I have tried with the GitHub repository ZIP but nothing works.
Installing the package using poetry does not solve the problem, it creates annother one:

python3 -m poetry add gd.py
Creating virtualenv gd-py-nIRGA3ZT-py3.8 in /home/zorin/.cache/pypoetry/virtualenvs

cannot import name 'BuildBackendException' from 'build' (/home/zorin/gd.py/build.py)

Can someone help please ? Thanks.
Errors are the same/I tested on Python 3.8 and Python 3.11 on Linux.

Level comment not work on Python 3.10

I trying to comment level but i'm getting that:

Traceback (most recent call last): File "G:\Мой диск\GDClient\main.py", line 70, in <module> client.run(clientC()) File "C:\Users\Denis\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gd\client.py", line 2350, in run return utils.run(coro, loop=self.loop, debug=debug) File "C:\Users\Denis\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gd\utils\async_utils.py", line 193, in run return loop.run_until_complete(coro) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.496.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 641, in run_until_complete return future.result() File "G:\Мой диск\GDClient\main.py", line 64, in clientC level = await client.get_level(levelToCommentID) File "C:\Users\Denis\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gd\client.py", line 625, in get_level level_data, creator_data, song_data = await self.session.get_level_info(level_id) File "C:\Users\Denis\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\gd\session.py", line 242, in get_level_info assert level_id >= -2, "Invalid Level ID provided." TypeError: '>=' not supported between instances of 'str' and 'int'

My code and inputs

levelToCommentID = input('Level to comment ID> ')
commentToLevel = input('Comment> ')
level = await client.get_level(levelToCommentID)
await level.comment(commentToLevel)
print('Done')

Level to comment ID> 76834708
Comment> amazing

My version

  • python v3.10.1-final
  • gd.py v0.11.0-final
  • aiohttp v3.7.4.post0
  • click v8.0.3
  • system Windows 10 10.0.19044

`check_id` validator in `entity` crash

This validator checks if the id is at least 0, but in reality it can be -1: a level with id 92984940 uses the song with this id - Practice: Stay Inside Me. When trying to fetch info about this level, an unhandled exception is thrown.

Client.save does not save

so i was using a signed in client with username and pass to save, but when i tried to load nothing happens

Reproduction Steps

On PyDroid 3

import gd
import asyncio
async def main():
    # client signing in
    await client.save()
asyncio.run(main())

Expected Results

when clicking load chnges should be visible

Actual Results

nothing happens with no error thrown

  • [x ] I have searched the open issues for duplicates.
  • [x ] I have shown the entire traceback, if possible.
  • [ x] I have removed my token from display, if visible.

System Information

/storage/emulated/0 $ python -m gd --version

  • python v3.9.7-final
  • gd.py v0.11.0-final
  • aiohttp v3.7.4.post0
  • click v8.0.3
  • system Linux 4.14.133+ 1 SMP PREEMPT Tue Nov 9 02:49:51 CST 2021
    /storage/emulated/0 $

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.