diff options
author | 谭九鼎 <109224573@qq.com> | 2022-05-09 21:38:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 21:38:53 +0800 |
commit | dc987c27390d91f1fef867952208beaf2624036c (patch) | |
tree | 7478daabef68c2c66d3717fd1302d686fd74f1f6 /examples | |
parent | 20ec774349a815f4c91f1d04d3bee01deb640cc3 (diff) | |
download | requests-cache-dc987c27390d91f1fef867952208beaf2624036c.tar.gz |
use https for links
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/basic_patching.py | 6 | ||||
-rwxr-xr-x | examples/basic_sessions.py | 6 | ||||
-rwxr-xr-x | examples/log_requests.py | 4 | ||||
-rwxr-xr-x | examples/url_patterns.py | 2 | ||||
-rw-r--r-- | examples/vcr.py | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/examples/basic_patching.py b/examples/basic_patching.py index 0e94b23..66842f2 100755 --- a/examples/basic_patching.py +++ b/examples/basic_patching.py @@ -16,15 +16,15 @@ requests_cache.install_cache('example_cache', backend='sqlite') def main(): # The real request will only be made once; afterward, the cached response is used for i in range(5): - response = requests.get('http://httpbin.org/get') + response = requests.get('https://httpbin.org/get') # This is more obvious when calling a slow endpoint for i in range(5): - response = requests.get('http://httpbin.org/delay/2') + response = requests.get('https://httpbin.org/delay/2') # Caching can be disabled if we want to get a fresh page and not cache it with requests_cache.disabled(): - print(requests.get('http://httpbin.org/ip').text) + print(requests.get('https://httpbin.org/ip').text) # Get some debugging info about the cache print(requests_cache.get_cache()) diff --git a/examples/basic_sessions.py b/examples/basic_sessions.py index 07e14bf..3c1e907 100755 --- a/examples/basic_sessions.py +++ b/examples/basic_sessions.py @@ -13,15 +13,15 @@ def main(): # The real request will only be made once; afterward, the cached response is used for i in range(5): - response = session.get('http://httpbin.org/get') + response = session.get('https://httpbin.org/get') # This is more obvious when calling a slow endpoint for i in range(5): - response = session.get('http://httpbin.org/delay/2') + response = session.get('https://httpbin.org/delay/2') # Caching can be disabled if we want to get a fresh page and not cache it with session.cache_disabled(): - print(session.get('http://httpbin.org/ip').text) + print(session.get('https://httpbin.org/ip').text) # Get some debugging info about the cache print(session.cache) diff --git a/examples/log_requests.py b/examples/log_requests.py index 035cc4e..266ffd0 100755 --- a/examples/log_requests.py +++ b/examples/log_requests.py @@ -20,7 +20,7 @@ logger = getLogger('requests_cache.examples') @contextmanager def log_requests(): """Context manager that mocks and logs all non-cached requests""" - real_response = set_response_defaults(requests.get('http://httpbin.org/get')) + real_response = set_response_defaults(requests.get('https://httpbin.org/get')) with patch.object(OriginalSession, 'send', return_value=real_response) as mock_send: session = CachedSession('cache-test', backend='sqlite') session.cache.clear() @@ -38,7 +38,7 @@ def main(): """Example usage; replace with any other requests you want to test""" with log_requests() as session: for i in range(10): - response = session.get('http://httpbin.org/get') + response = session.get('https://httpbin.org/get') logger.debug(f'Response {i}: {type(response).__name__}') diff --git a/examples/url_patterns.py b/examples/url_patterns.py index c948fef..d61f3c1 100755 --- a/examples/url_patterns.py +++ b/examples/url_patterns.py @@ -16,7 +16,7 @@ urls_expire_after = { urls = [ 'https://httpbin.org/get', # Will expire in an hour 'https://httpbin.org/image/jpeg', # Will expire in a week - 'http://www.fillmurray.com/460/300', # Will never expire + 'https://www.fillmurray.com/460/300', # Will never expire 'https://via.placeholder.com/350x150', # Will not be cached ] diff --git a/examples/vcr.py b/examples/vcr.py index bf58046..94e4fdb 100644 --- a/examples/vcr.py +++ b/examples/vcr.py @@ -94,6 +94,6 @@ def write_cassette(cassette, path): if __name__ == '__main__': cache_dir = 'example_cache' session = CachedSession(join(cache_dir, 'http_cache.sqlite')) - session.get('http://httpbin.org/get') - session.get('http://httpbin.org/json') + session.get('https://httpbin.org/get') + session.get('https://httpbin.org/json') to_vcr_cassette(session.cache, join(cache_dir, 'http_cache.yaml')) |