MCPcopy Create free account

hub / github.com/requests-cache/requests-cache / functions

Functions788 in github.com/requests-cache/requests-cache

↓ 309 callersMethodget
(self, url: str, params=None, **kwargs)
requests_cache/session.py:131
↓ 42 callersFunctionhttpbin
Get the url for either a local or remote httpbin instance
tests/conftest.py:104
↓ 42 callersMethodkeys
(self)
requests_cache/backends/redis.py:123
↓ 40 callersMethodinit_session
(self, cache_name=CACHE_NAME, clear=True, **kwargs)
tests/integration/base_cache_test.py:53
↓ 34 callersFunctionutcnow
Get the current time in UTC (timezone-aware)
requests_cache/policy/expiration.py:89
↓ 33 callersMethodcontains
Check if the specified request is cached Args: key: Check for a specific cache key request: Check for a matching requ
requests_cache/backends/base.py:142
↓ 33 callersMethodfrom_request
Initialize from request info and cache settings. Note on refreshing: `must-revalidate` isn't a standard request header, but is used here to
requests_cache/policy/actions.py:85
↓ 29 callersMethodrequest
This method prepares and sends a request while automatically performing any necessary caching operations. This will be called by any other met
requests_cache/session.py:155
↓ 26 callersMethodclear
Delete all items from the cache
requests_cache/backends/base.py:110
↓ 26 callersMethoditems
(self)
requests_cache/backends/redis.py:127
↓ 25 callersMethodconnection
Get a thread-local database connection
requests_cache/backends/sqlite.py:248
↓ 25 callersMethoddelete
(self, url: str, **kwargs)
requests_cache/session.py:152
↓ 24 callersMethodinit_cache
(self, clear=True, **kwargs)
tests/integration/test_memory.py:13
↓ 22 callersMethodpost
(self, url: str, data=None, **kwargs)
requests_cache/session.py:143
↓ 21 callersMethodsize
Return the size of the database, in bytes. For an in-memory database, this will be an estimate based on page size.
requests_cache/backends/sqlite.py:399
↓ 20 callersMethodinit_cache
(self, cache_name=CACHE_NAME, index=0, clear=True, **kwargs)
tests/integration/base_storage_test.py:22
↓ 19 callersFunctioncreate_key
Create a normalized cache key based on a request object Args: request: Request object to generate a cache key from ignored_parame
requests_cache/cache_keys.py:55
↓ 19 callersMethodvalues
(self)
requests_cache/backends/redis.py:131
↓ 18 callersMethodinit_cache
Initialize a LRUFileDict with common test parameters. Args: shared_cache_name: If provided, use this exact cache name (for multi-
tests/integration/test_filesystem.py:88
↓ 18 callersMethodprepare
Convert the CachedRequest back into a PreparedRequest
requests_cache/models/request.py:43
↓ 17 callersMethodfrom_response
Create a CachedResponse based on an original Response or another CachedResponse object
requests_cache/models/response.py:95
↓ 17 callersMethodupdate_from_cached_response
Determine if we can reuse a cached response, or set headers for a conditional request if possible. Used after fetching a cached respo
requests_cache/policy/actions.py:184
↓ 16 callersFunctionget_expiration_datetime
Convert an expiration value in any supported format to an absolute datetime
requests_cache/policy/expiration.py:22
↓ 15 callersMethodpaths
Get absolute file paths to all cached responses
requests_cache/backends/filesystem.py:170
↓ 15 callersMethodupdate
Update this cache with the contents of another cache
requests_cache/backends/base.py:282
↓ 14 callersFunctionget_placeholder_class
Create a placeholder type for a class that does not have dependencies installed. This allows delaying ImportErrors until init time, rather than at
requests_cache/_utils.py:44
↓ 13 callersMethodsorted
Get cache values in sorted order; see :py:meth:`.SQLiteCache.sorted` for usage details
requests_cache/backends/sqlite.py:415
↓ 12 callersMethodread
Simplified reader for cached content that emulates :py:meth:`urllib3.response.HTTPResponse.read()`, but does not need to read from a socket
requests_cache/models/raw_response.py:86
↓ 12 callersMethodsave_response
Save a response to the cache Args: cache_key: Cache key for this response; will otherwise be generated based on request
requests_cache/backends/base.py:87
↓ 11 callersMethodsend
Send a prepared request, with caching. See :py:meth:`requests.Session.send` for base parameters, and see :py:meth:`.request` for extra paramet
requests_cache/session.py:191
↓ 10 callersMethodcount
Count number of responses, optionally excluding expired
requests_cache/backends/sqlite.py:383
↓ 10 callersMethodinit_cache
(self, **kwargs)
tests/integration/test_filesystem.py:325
↓ 10 callersFunctionnormalize_request
Normalize and remove ignored parameters from request URL, body, and headers. This is used for both: * Increasing cache hits by generating mor
requests_cache/cache_keys.py:114
↓ 9 callersMethodget_lru
Get the least recently used keys with a combined size >= total_size
requests_cache/backends/filesystem.py:434
↓ 9 callersFunctionget_valid_kwargs
Get the subset of non-None ``kwargs`` that are valid arguments for ``func``
requests_cache/_utils.py:69
↓ 9 callersMethodtotal_size
(self)
requests_cache/backends/filesystem.py:473
↓ 8 callersMethod_key2path
(self, key: str)
requests_cache/backends/filesystem.py:133
↓ 8 callersMethodbulk_commit
Insert a large number of records within a single transaction Example: >>> d1 = SQLiteDict('test') >>> with d1.bulk_c
requests_cache/backends/sqlite.py:283
↓ 8 callersMethodcreate_key
Create a normalized cache key from a request object
requests_cache/backends/base.py:122
↓ 8 callersMethoddeserialize
Deserialize a value, if a serializer is available. If deserialization fails (usually due to a value saved in an older requests-cache version)
requests_cache/backends/base.py:353
↓ 8 callersFunctionencode
Encode a value to bytes, if it hasn't already been
requests_cache/_utils.py:37
↓ 8 callersFunctionget_mock_response
( method='GET', url='https://img.site.com/base/img.jpg', status_code=200, headers=None, re
tests/conftest.py:276
↓ 8 callersMethodserialize
Serialize a value, if a serializer is available
requests_cache/backends/base.py:347
↓ 7 callersMethod_get_size_on_disk
Return a file size on disk, rounded up to fit the blocks on the file system
requests_cache/backends/filesystem.py:299
↓ 7 callersFunctiondecode
Decode a value from bytes, if hasn't already been. Note: ``PreparedRequest.body`` is always encoded in utf-8.
requests_cache/_utils.py:28
↓ 7 callersMethoddumps
(self, value)
tests/unit/test_base_cache.py:147
↓ 7 callersMethodis_usable
Determine whether a given cached response is "fresh enough" to satisfy the request, based on: * min-fresh * max-stale
requests_cache/policy/actions.py:155
↓ 7 callersFunctionmake_stage
Create a preconf serializer stage from a module name, if dependencies are installed. For JSON converters, force base64 encoding; cattrs defaults
requests_cache/serializers/preconf.py:19
↓ 7 callersFunctionnormalize_headers
Sort and filter request headers, and normalize minor variations in multi-value headers
requests_cache/cache_keys.py:145
↓ 7 callersMethodset_ttl
Create or update a TTL index, and ignore and log any errors due to dropping a nonexistent index or attempting to overwrite without ```overwrit
requests_cache/backends/mongodb.py:101
↓ 6 callersMethod_bkey
(self, key: str)
requests_cache/backends/redis.py:77
↓ 6 callersFunction_scan_page
(keys: list, last_key=None)
tests/integration/test_dynamodb.py:134
↓ 6 callersMethodbulk_delete
Delete multiple keys from the cache, without raising errors for missing keys
requests_cache/backends/redis.py:112
↓ 6 callersMethodcache_disabled
Context manager for temporary disabling the cache .. warning:: This method is not thread-safe. Example: >>> s
requests_cache/session.py:342
↓ 6 callersMethodclose
Close the session and any open backend connections
requests_cache/session.py:364
↓ 6 callersMethodget_response
Retrieve a response from the cache, if it exists Args: key: Cache key for the response default: Value to return if `k
requests_cache/backends/base.py:72
↓ 6 callersMethodinit_cache
For tests that use multiple tables, make index part of the table name
tests/integration/test_dynamodb.py:35
↓ 6 callersMethodloads
(self, value)
tests/unit/test_base_cache.py:150
↓ 6 callersMethodurls
Get all unique cached URLs. Optionally takes keyword arguments for :py:meth:`.filter`.
requests_cache/backends/base.py:288
↓ 5 callersMethod_try_io
Attempt an I/O operation, and either ignore errors or re-raise them as KeyErrors
requests_cache/backends/filesystem.py:124
↓ 5 callersMethodclear
(self)
requests_cache/backends/filesystem.py:425
↓ 5 callersMethodfilter
Get responses from the cache, with optional filters for which responses to include: Args: valid: Include valid and unexpired resp
requests_cache/backends/base.py:211
↓ 5 callersMethodget_ttl
Get the currently defined TTL value in seconds, if any
requests_cache/backends/mongodb.py:96
↓ 5 callersFunctionmount_mock_adapter
(session: CachedSession)
tests/conftest.py:173
↓ 5 callersMethodreset_expiration
Set a new expiration value to set on existing cache items Args: expire_after: New expiration value, **relative to the current tim
requests_cache/backends/base.py:271
↓ 5 callersFunctionrun_serialize_deserialize
(module, serializer)
tests/benchmark_serializers.py:92
↓ 5 callersMethodupdate_from_response
Update expiration + actions based on headers and other details from a new response. Used after receiving a new response, but before saving it
requests_cache/policy/actions.py:223
↓ 5 callersMethodvacuum
(self)
requests_cache/backends/sqlite.py:449
↓ 4 callersMethod_send_and_cache
Send a request and cache the response, unless disabled by settings or headers. If applicable, also handle conditional requests.
requests_cache/session.py:268
↓ 4 callersMethoddelete
Remove responses from the cache according one or more conditions. Args: keys: Remove responses with these cache keys
requests_cache/backends/base.py:163
↓ 4 callersFunctionfilter_sort_dict
( data: Mapping[str, str], ignored_parameters: ParamList = None, )
requests_cache/cache_keys.py:261
↓ 4 callersFunctionget_cache
Get the internal cache object from the currently installed ``CachedSession`` (if any)
requests_cache/patcher.py:99
↓ 4 callersFunctionget_expiration_seconds
Convert an expiration value in any supported format to an expiration time in seconds
requests_cache/policy/expiration.py:60
↓ 4 callersMethodinit_db
Initialize the database, if it hasn't already been
requests_cache/backends/sqlite.py:228
↓ 4 callersFunctioninit_serializer
Initialize a serializer by name or instance
requests_cache/serializers/__init__.py:75
↓ 4 callersMethodlog
(self, msg: str)
examples/rps_graph.py:98
↓ 4 callersMethodread
(self)
tests/unit/test_cache_keys.py:220
↓ 4 callersFunctionsafe_pickle_serializer
Create a serializer that uses ``pickle`` + ``itsdangerous`` to add a signature to responses on write, and validate that signature with a secret ke
requests_cache/serializers/preconf.py:79
↓ 4 callersMethodset_decode_content
Set decode_content, if the pipeline contains a CattrStage or compatible object
requests_cache/serializers/pipeline.py:75
↓ 4 callersFunctionset_request_headers
Translate keyword arguments into equivalent request headers
requests_cache/policy/directives.py:69
↓ 4 callersMethodupdate_access_time
Update the given key with the current timestamp Raises: KeyError: If the key doesn't exist in the LRU index
requests_cache/backends/filesystem.py:478
↓ 3 callersMethod__init__
(self, *args, **kwargs)
requests_cache/backends/filesystem.py:334
↓ 3 callersMethod_acquire_sqlite_lock
(self)
requests_cache/backends/sqlite.py:298
↓ 3 callersFunction_log_error
()
requests_cache/_utils.py:49
↓ 3 callersFunction_patch_session_factory
(session_factory: Type[OriginalSession] = CachedSession)
requests_cache/patcher.py:124
↓ 3 callersFunction_reset_fp
Set content and reset raw response file pointer
requests_cache/models/raw_response.py:141
↓ 3 callersFunction_valid_serializer
(serializer)
tests/integration/test_filesystem.py:34
↓ 3 callersMethodclose
Close any open backend connections
requests_cache/backends/base.py:116
↓ 3 callersMethodclose
Close any active connections
requests_cache/backends/sqlite.py:275
↓ 3 callersMethodcopy
(self)
requests_cache/serializers/pipeline.py:33
↓ 3 callersFunctionfilter_url
Filter ignored parameters out of a URL
requests_cache/cache_keys.py:285
↓ 3 callersFunctionformat_file_size
Convert a file size in bytes into a human-readable format
requests_cache/models/response.py:208
↓ 3 callersMethodfrom_headers
Parse cache directives and other settings from request or response headers
requests_cache/policy/directives.py:34
↓ 3 callersFunctionget_url_expiration
Check for a matching per-URL expiration, if any
requests_cache/policy/expiration.py:66
↓ 3 callersFunctioninstall_cache
Install the cache for all ``requests`` functions by monkey-patching :py:class:`requests.Session` Example: >>> requests_cache.instal
requests_cache/patcher.py:24
↓ 3 callersFunctionis_json_content_type
Returns whether the given content-type represents json
requests_cache/_utils.py:110
↓ 3 callersFunctionnormalize_json_body
Normalize and filter a request body with serialized JSON data
requests_cache/cache_keys.py:201
↓ 3 callersMethodput
(self, url: str, data=None, **kwargs)
requests_cache/session.py:146
↓ 3 callersMethodrecreate_keys
Recreate cache keys for all previously cached responses
requests_cache/backends/base.py:244
↓ 3 callersMethodreset
Reset raw response file pointer, and optionally update content
requests_cache/models/raw_response.py:106
next →1–100 of 788, ranked by callers