-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Remove deprecated advocate package (#6944)"
This reverts commit bd115e7, as it turns out to be a useful security feature. In order to remove this in a better way, we'll need to replace it with something that provides equivalent functionality.
- Loading branch information
1 parent
bd115e7
commit 62890c3
Showing
8 changed files
with
137 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from advocate.exceptions import UnacceptableAddressException # noqa: F401 | ||
|
||
from redash import settings | ||
|
||
if settings.ENFORCE_PRIVATE_ADDRESS_BLOCK: | ||
import advocate as requests_or_advocate | ||
else: | ||
import requests as requests_or_advocate | ||
|
||
|
||
class ConfiguredSession(requests_or_advocate.Session): | ||
def request(self, *args, **kwargs): | ||
if not settings.REQUESTS_ALLOW_REDIRECTS: | ||
kwargs.update({"allow_redirects": False}) | ||
return super().request(*args, **kwargs) | ||
|
||
|
||
requests_session = ConfiguredSession() |
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