diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/conf.py | 2 | ||||
-rw-r--r-- | docs/user_guide/advanced_requests.md | 4 | ||||
-rw-r--r-- | docs/user_guide/expiration.md | 14 | ||||
-rw-r--r-- | docs/user_guide/filtering.md | 4 | ||||
-rw-r--r-- | docs/user_guide/general.md | 18 | ||||
-rw-r--r-- | docs/user_guide/inspection.md | 4 | ||||
-rw-r--r-- | docs/user_guide/matching.md | 16 |
7 files changed, 31 insertions, 31 deletions
diff --git a/docs/conf.py b/docs/conf.py index 17fd900..1b97319 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -76,7 +76,7 @@ exclude_patterns = [ # Enable automatic links to other projects' Sphinx docs intersphinx_mapping = { 'boto3': ('https://boto3.amazonaws.com/v1/documentation/api/latest/', None), - 'botocore': ('http://botocore.readthedocs.io/en/latest/', None), + 'botocore': ('https://botocore.readthedocs.io/en/latest/', None), 'cryptography': ('https://cryptography.io/en/latest/', None), 'itsdangerous': ('https://itsdangerous.palletsprojects.com/en/2.0.x/', None), 'pymongo': ('https://pymongo.readthedocs.io/en/stable/', None), diff --git a/docs/user_guide/advanced_requests.md b/docs/user_guide/advanced_requests.md index fcd5a6c..c6ec9c7 100644 --- a/docs/user_guide/advanced_requests.md +++ b/docs/user_guide/advanced_requests.md @@ -27,8 +27,8 @@ It can be used, for example, for request throttling: >>> session = CachedSession() >>> session.hooks['response'].append(make_throttle_hook(0.1)) >>> # The first (real) request will have an added delay ->>> session.get('http://httpbin.org/get') ->>> session.get('http://httpbin.org/get') +>>> session.get('https://httpbin.org/get') +>>> session.get('https://httpbin.org/get') ``` ::: diff --git a/docs/user_guide/expiration.md b/docs/user_guide/expiration.md index b0628fb..803c74b 100644 --- a/docs/user_guide/expiration.md +++ b/docs/user_guide/expiration.md @@ -190,7 +190,7 @@ The `expire_after` argument can be used to override the session's expiration for ```python >>> session = CachedSession(expire_after=300) >>> # This request will be cached for 60 seconds, not 300 ->>> session.get('http://httpbin.org/get', expire_after=60) +>>> session.get('https://httpbin.org/get', expire_after=60) ``` ### Manual Refresh @@ -206,8 +206,8 @@ described above. Example: ```python ->>> response_1 = session.get('http://httpbin.org/get') ->>> response_2 = session.get('http://httpbin.org/get', refresh=True) +>>> response_1 = session.get('https://httpbin.org/get') +>>> response_2 = session.get('https://httpbin.org/get', refresh=True) >>> assert response_2.from_cache is False ``` @@ -227,21 +227,21 @@ cached or is expired, you will get a `504 Not Cached` response instead. ```python >>> session = CachedSession() >>> session.cache.clear() ->>> response = session.get('http://httpbin.org/get', only_if_cached=True) +>>> response = session.get('https://httpbin.org/get', only_if_cached=True) >>> print(response.status_code) 504 >>> response.raise_for_status() -HTTPError: 504 Server Error: Not Cached for url: http://httpbin.org/get +HTTPError: 504 Server Error: Not Cached for url: https://httpbin.org/get ``` You can also combine this with `stale_if_error` to return cached responses even if they are expired. ```python >>> session = CachedSession(expire_after=1, stale_if_error=True) ->>> session.get('http://httpbin.org/get') +>>> session.get('https://httpbin.org/get') >>> time.sleep(1) >>> # The response will be cached but expired by this point ->>> response = session.get('http://httpbin.org/get', only_if_cached=True) +>>> response = session.get('https://httpbin.org/get', only_if_cached=True) >>> print(response.status_code) 200 ``` diff --git a/docs/user_guide/filtering.md b/docs/user_guide/filtering.md index e2afa70..d514770 100644 --- a/docs/user_guide/filtering.md +++ b/docs/user_guide/filtering.md @@ -15,7 +15,7 @@ with a regular {py:class}`requests.Session` object, or wrapper functions like To cache additional HTTP methods, specify them with `allowable_methods`: ```python >>> session = CachedSession(allowable_methods=('GET', 'POST')) ->>> session.post('http://httpbin.org/post', json={'param': 'value'}) +>>> session.post('https://httpbin.org/post', json={'param': 'value'}) ``` For example, some APIs use the `POST` method to request data via a JSON-formatted request body, for @@ -26,7 +26,7 @@ to ensure you don't send the exact same data multiple times. To cache additional status codes, specify them with `allowable_codes` ```python >>> session = CachedSession(allowable_codes=(200, 418)) ->>> session.get('http://httpbin.org/teapot') +>>> session.get('https://httpbin.org/teapot') ``` (selective-caching)= diff --git a/docs/user_guide/general.md b/docs/user_guide/general.md index 4083794..1f4b17c 100644 --- a/docs/user_guide/general.md +++ b/docs/user_guide/general.md @@ -11,21 +11,21 @@ Basic usage looks like this: >>> from requests_cache import CachedSession >>> session = CachedSession() ->>> session.get('http://httpbin.org/get') +>>> session.get('https://httpbin.org/get') ``` Any {py:class}`requests.Session` method can be used (but see {ref}`http-methods` section for options): ```python ->>> session.request('GET', 'http://httpbin.org/get') ->>> session.head('http://httpbin.org/get') +>>> session.request('GET', 'https://httpbin.org/get') +>>> session.head('https://httpbin.org/get') ``` Caching can be temporarily disabled for the session with {py:meth}`.CachedSession.cache_disabled`: ```python >>> with session.cache_disabled(): -... session.get('http://httpbin.org/get') +... session.get('https://httpbin.org/get') ``` The best way to clean up your cache is through {ref}`expiration` settings, but you can also @@ -44,13 +44,13 @@ functions, without the need to modify any existing code: >>> import requests_cache >>> requests_cache.install_cache() ->>> requests.get('http://httpbin.org/get') +>>> requests.get('https://httpbin.org/get') ``` As well as session methods: ```python >>> session = requests.Session() ->>> session.get('http://httpbin.org/get') +>>> session.get('https://httpbin.org/get') ``` {py:func}`.install_cache` accepts all the same parameters as {py:class}`.CachedSession`: @@ -61,20 +61,20 @@ As well as session methods: It can be temporarily {py:func}`.enabled`: ```python >>> with requests_cache.enabled(): -... requests.get('http://httpbin.org/get') # Will be cached +... requests.get('https://httpbin.org/get') # Will be cached ``` Or temporarily {py:func}`.disabled`: ```python >>> requests_cache.install_cache() >>> with requests_cache.disabled(): -... requests.get('http://httpbin.org/get') # Will not be cached +... requests.get('https://httpbin.org/get') # Will not be cached ``` Or completely removed with {py:func}`.uninstall_cache`: ```python >>> requests_cache.uninstall_cache() ->>> requests.get('http://httpbin.org/get') +>>> requests.get('https://httpbin.org/get') ``` You can also clear out all responses in the cache with {py:func}`.clear`, and check if diff --git a/docs/user_guide/inspection.md b/docs/user_guide/inspection.md index c1db134..9c21389 100644 --- a/docs/user_guide/inspection.md +++ b/docs/user_guide/inspection.md @@ -21,12 +21,12 @@ Examples: >>> session = CachedSession(expire_after=timedelta(days=1)) >>> # Placeholders are added for non-cached responses ->>> response = session.get('http://httpbin.org/get') +>>> response = session.get('https://httpbin.org/get') >>> print(response.from_cache, response.created_at, response.expires, response.is_expired) False None None None >>> # Values will be populated for cached responses ->>> response = session.get('http://httpbin.org/get') +>>> response = session.get('https://httpbin.org/get') >>> print(response.from_cache, response.created_at, response.expires, response.is_expired) True 2021-01-01 18:00:00 2021-01-02 18:00:00 False diff --git a/docs/user_guide/matching.md b/docs/user_guide/matching.md index 9c0ee08..596298b 100644 --- a/docs/user_guide/matching.md +++ b/docs/user_guide/matching.md @@ -11,8 +11,8 @@ them separately. To enable this, use `match_headers`: ```python >>> session = CachedSession(match_headers=True) >>> # Both of these requests will be sent and cached separately ->>> session.get('http://httpbin.org/headers', {'Accept': 'text/plain'}) ->>> session.get('http://httpbin.org/headers', {'Accept': 'application/json'}) +>>> session.get('https://httpbin.org/headers', {'Accept': 'text/plain'}) +>>> session.get('https://httpbin.org/headers', {'Accept': 'application/json'}) ``` If you only want to match specific headers and not others, you can provide them as a list: @@ -32,8 +32,8 @@ In this example, only the first request will be sent, and the second request wil due to the ignored parameters: ```python >>> session = CachedSession(ignored_parameters=['auth-token']) ->>> session.get('http://httpbin.org/get', params={'auth-token': '2F63E5DF4F44'}) ->>> r = session.get('http://httpbin.org/get', params={'auth-token': 'D9FAEB3449D3'}) +>>> session.get('https://httpbin.org/get', params={'auth-token': '2F63E5DF4F44'}) +>>> r = session.get('https://httpbin.org/get', params={'auth-token': 'D9FAEB3449D3'}) >>> assert r.from_cache is True ``` @@ -42,8 +42,8 @@ due to the ignored parameters: This also applies to parameters in a JSON-formatted request body: ```python >>> session = CachedSession(allowable_methods=('GET', 'POST'), ignored_parameters=['auth-token']) ->>> session.post('http://httpbin.org/post', json={'auth-token': '2F63E5DF4F44'}) ->>> r = session.post('http://httpbin.org/post', json={'auth-token': 'D9FAEB3449D3'}) +>>> session.post('https://httpbin.org/post', json={'auth-token': '2F63E5DF4F44'}) +>>> r = session.post('https://httpbin.org/post', json={'auth-token': 'D9FAEB3449D3'}) >>> assert r.from_cache is True ``` @@ -52,8 +52,8 @@ This also applies to parameters in a JSON-formatted request body: As well as headers, if `match_headers` is also used: ```python >>> session = CachedSession(ignored_parameters=['auth-token'], match_headers=True) ->>> session.get('http://httpbin.org/get', headers={'auth-token': '2F63E5DF4F44'}) ->>> r = session.get('http://httpbin.org/get', headers={'auth-token': 'D9FAEB3449D3'}) +>>> session.get('https://httpbin.org/get', headers={'auth-token': '2F63E5DF4F44'}) +>>> r = session.get('https://httpbin.org/get', headers={'auth-token': 'D9FAEB3449D3'}) >>> assert r.from_cache is True ``` ```{note} |