HTTP API Reference

All endpoint functions are accessible from your discord.Client._http attribute.

async HTTP.get_gateway() HTTPResponse[source]

Returns an object containing a valid WSS URL which the application can use when connecting to the gateway

async HTTP.get_gateway_bot() HTTPResponse[source]

Returns an object based on the information in get_gateway(), plus additional metadata that can help during the operation of large or sharded bots.

class discord._http.HTTPResponse[source]

Represents an HTTP response.

Utilizes __getitem__(key) method for retrieving values in the BODY of the response, if key exists.

response: HTTPResponse = await client._http.sample_endpoint()
response["sample_key"] # "sample value"
property reason: str

HTTP status reason of the response

property status: int

HTTP status code of the response