-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix caching after migration to Niquests
- Loading branch information
Showing
6 changed files
with
36 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
from sys import modules | ||
|
||
import niquests | ||
import urllib3 | ||
import requests_cache | ||
|
||
|
||
class CachedSession(requests_cache.session.CacheMixin, niquests.Session): | ||
""" | ||
Make Niquests compatible with Requests-Cache. | ||
""" | ||
|
||
# Amalgamate the module namespace to make all modules aiming | ||
# to use `requests`, in fact use `niquests` instead. | ||
modules["requests"] = niquests | ||
modules["requests.adapters"] = niquests.adapters | ||
modules["requests.sessions"] = niquests.sessions | ||
modules["requests.exceptions"] = niquests.exceptions | ||
modules["requests.packages.urllib3"] = urllib3 | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters