Skip to content

Commit

Permalink
📝 update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Nov 15, 2024
1 parent bed1bcf commit ea06720
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/usage/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ github = GitHub(
user_agent="GitHubKit/Python",
follow_redirects=True,
timeout=None,
cache_strategy=None,
http_cache=True,
auto_retry=True,
rest_api_validate_body=True,
Expand All @@ -24,13 +25,15 @@ Or, you can pass the config object directly (not recommended):
import httpx
from githubkit import GitHub, Config
from githubkit.retry import RETRY_DEFAULT
from githubkit.cache import DEFAULT_CACHE_STRATEGY

config = Config(
base_url="https://api.github.com/",
accept="application/vnd.github+json",
user_agent="GitHubKit/Python",
follow_redirects=True,
timeout=httpx.Timeout(None),
cache_strategy=DEFAULT_CACHE_STRATEGY,
http_cache=True,
auto_retry=RETRY_DEFAULT,
rest_api_validate_body=True,
Expand Down Expand Up @@ -65,6 +68,10 @@ The `follow_redirects` option is used to enable or disable the HTTP redirect fol

The `timeout` option is used to set the request timeout. You can pass a float, `None` or `httpx.Timeout` to this field. By default, the requests will never timeout. See [Timeout](https://www.python-httpx.org/advanced/timeouts/) for more information.

### `cache_strategy`

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.

### `http_cache`

The `http_cache` option enables the http caching feature powered by [Hishel](https://hishel.com/) for HTTPX. GitHub API limits the number of requests that you can make within a specific amount of time. This feature is useful to reduce the number of requests to GitHub API and avoid hitting the rate limit.
Expand Down

0 comments on commit ea06720

Please sign in to comment.