Skip to content
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

ClientResponseError: 400, message='Bad Request' when querying census API #64

Closed
yakMM opened this issue Apr 25, 2023 · 4 comments
Closed

Comments

@yakMM
Copy link

yakMM commented Apr 25, 2023

Hello, I'm recently getting an error when querying the census API with auraxium.

I don't know if the problem is coming from an API change on Daybreak side or a recent change in the auraxium module.

The problem is fixed if I cast the url to str (using str(url) instead of url) here:

url, allow_redirects=False, raise_for_status=True)

Does the problem come from using yarl.URL object directly?

@yakMM
Copy link
Author

yakMM commented Apr 25, 2023

I can reproduce the problem with the README example:

import asyncio
import auraxium
from auraxium import ps2


async def main():
    async with auraxium.Client() as client:
        char = await client.get_by_name(ps2.Character, 'auroram')
        print(char.name)
        print(char.data.prestige_level)

asyncio.run(main())

Gives:

auraxium.errors.ResponseError: An HTTP exception occurred

Fixed by casting the url as explained above.

@leonhard-s
Copy link
Owner

Hi, thank you for the report. I have been observing similar issues in the CI runs for https://github.com/leonhard-s/ps2-api-backup but was unable to reproduce it locally.

I will do some digging to see what caused this; there have been no changes to Auraxium lately. Either a new version of yarl changed a behaviour, or it was an API change.

@leonhard-s
Copy link
Owner

The error appears to have been an upstream issue related to a regression in yarl==1.9.1 or one of its dependencies. Version 1.9.2 of yarl no longer breaks requests.

I do not immediately see a connection to the only regression they mention in the release notes (aio-libs/yarl#854), but I have not had time to investigate it in detail. Especially the explicit cast to str fixing the issue is quite interesting.

@yakMM please let me know if the issue is fixed for you after updating to yarl 1.9.2.

@yakMM
Copy link
Author

yakMM commented Apr 26, 2023

The issue is indeed resolved with yarl 1.9.2, thanks.

Didn't really look in details, plus I don't really know about yarl, but the issue you are linking resembles very much the weird behavior I was experimenting.

This comment for example matches: aio-libs/yarl#854 (comment)

@yakMM yakMM closed this as completed Apr 26, 2023
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

No branches or pull requests

2 participants