Adjust examples to reflect the new top-level exposure of classes and enums, such as `Client`, `Permissions`, `Embed`, and `Button`, making imports simpler.
32 lines
843 B
Markdown
32 lines
843 B
Markdown
# HTTP Client Options
|
|
|
|
Disagreement uses `aiohttp` for all HTTP requests. Additional options for the
|
|
underlying `aiohttp.ClientSession` can be provided when constructing a
|
|
`Client` or an `HTTPClient` directly.
|
|
|
|
```python
|
|
import aiohttp
|
|
from disagreement import Client
|
|
|
|
connector = aiohttp.TCPConnector(limit=50)
|
|
client = Client(
|
|
token="YOUR_TOKEN",
|
|
http_options={"proxy": "http://localhost:8080", "connector": connector},
|
|
)
|
|
```
|
|
|
|
These options are passed through to `aiohttp.ClientSession` when the session is
|
|
created. You can set a proxy URL, provide a custom connector, or supply any
|
|
other supported session argument.
|
|
|
|
## Get Current User Guilds
|
|
|
|
The HTTP client can list the guilds the bot user is in:
|
|
|
|
```python
|
|
from disagreement import HTTPClient
|
|
|
|
http = HTTPClient(token="TOKEN")
|
|
guilds = await http.get_current_user_guilds()
|
|
```
|