We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Create message endpoint fails with cloudflare's status code 520 when:
Create message
import httpx size_mb = 7 size = size_mb * 1024 * 1024 # Convert MB to bytes data = b'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' with open("random_file.txt", 'wb+') as file: while size > 0: chunk_size = min(1024 * 1024, size) file.write(data * (chunk_size // len(data))) size -= chunk_size channel_id = 1207210135194181685 test_url = f"https://discord.com/api/v10/channels/{channel_id}/messages" with httpx.Client(timeout=None) as client: res = client.post(test_url, files={'file': file}, headers={"Authorization": "Bot invalidTokenHere"}) print(res.status_code)
Weirdly, this only happens when using the httpx library—when I switch to requests, I get a 401 as expected.
httpx
requests
This suggests that httpx and requests handle the request differently, but it also indicates a potential bug in the API
The API returns 401 status code.
401
The API returns 520 status code.
520
No response
Windows 10 python=3.9 httpx==0.26.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Create message
endpoint fails with cloudflare's status code 520 when:Steps to Reproduce
Weirdly, this only happens when using the
httpx
library—when I switch torequests
, I get a 401 as expected.This suggests that
httpx
andrequests
handle the request differently, but it also indicates a potential bug in the APIExpected Behavior
The API returns
401
status code.Current Behavior
The API returns
520
status code.Screenshots/Videos
No response
Client and System Information
Windows 10
python=3.9
httpx==0.26.0
The text was updated successfully, but these errors were encountered: