Skip to content

Commit e027d05

Browse files
committed
📝 add docs for transport configuration
1 parent 5eb8f0b commit e027d05

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/usage/configuration.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,23 @@ If `trust_env` is set to `True`, githubkit (httpx) will look for the environment
8484

8585
If you want to set a proxy for client programmatically, you can pass a proxy URL to the `proxy` option. See [httpx's proxies documentation](https://www.python-httpx.org/advanced/proxies/) for more information.
8686

87+
### `transport`, `async_transport`
88+
89+
These two options let you provide a custom [HTTPX transport](https://www.python-httpx.org/advanced/transports/) for the underlying HTTP client.
90+
91+
They accept instances of the following types:
92+
93+
- `httpx.BaseTransport` (sync transport) — pass via the `transport` option.
94+
- `httpx.AsyncBaseTransport` (async transport) — pass via the `async_transport` option.
95+
96+
When provided, githubkit will forward the transport to create the client. This is useful for:
97+
98+
- providing a custom network implementation;
99+
- injecting test-only transports (for example `httpx.MockTransport`) to stub responses in unit tests;
100+
- using alternative transports provided by HTTPX or third parties.
101+
102+
Note that if you pass `None` to the option, the default transport will be created by HTTPX.
103+
87104
### `cache_strategy`
88105

89106
The `cache_strategy` option defines how to cache the tokens or http responses. You can provide a githubkit built-in cache strategy or a custom one that implements the `BaseCacheStrategy` interface. By default, githubkit uses the `MemCacheStrategy` to cache the data in memory.

0 commit comments

Comments
 (0)