Skip to content

Fix | ValueError in http.py: Retry-After, Can't convert float to int. #816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Carter2565
Copy link

Summary

As said in title. Changes Retry-After values to floats instead of int.

Discovery issue/error log:

Task exception was never retrieved
future: <Task finished name='Task-215' coro=<renew_bot() done, defined at C:\Users\Carter2565\Desktop\Jam\BadgeMe\Main-current.py:421> exception=ValueError("invalid literal for int() with base 10: '1.939'")> 
Traceback (most recent call last):
  File "C:\Users\Carter2565\Desktop\Jam\BadgeMe\Main-current.py", line 425, in renew_bot
    application_commands = await channel.application_commands()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Carter2565\Desktop\Jam\BadgeMe\discordself\abc.py", line 2571, in application_commands 
    data = await state.http.guild_application_command_index(guild_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Carter2565\Desktop\Jam\BadgeMe\discordself\http.py", line 943, in request
    if int(response.headers['Retry-After']) == int(retry_after / 1000):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '1.939'
2025-04-01 09:02:16 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: 4525e1c1e6f33f29d12ca15e41997149).
Renewing App <@!1263200122284802202>

Contact Info:
Signal - @Carter.2565
Discord- @Carter2565
Telegram- @Carter2565

General Info

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue (please put issue # in summary).
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@dolfies
Copy link
Owner

dolfies commented Apr 7, 2025

Looks like this is a special case for this endpoint as it is not hosted on the API, instead proxied to a rust service that responds differently I'll take a look at this when I have time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants