Class method for checking if urls are blocked

This commit is contained in:
Mouse Reeve
2021-04-10 11:38:57 -07:00
parent 0caeb3ac33
commit 1903812b1d
3 changed files with 17 additions and 15 deletions

View File

@ -219,6 +219,12 @@ def dict_from_mappings(data, mappings):
def get_data(url, params=None):
""" wrapper for request.get """
# check if the url is blocked
if models.FederatedServer.is_blocked(url):
raise ConnectorException(
"Attempting to load data from blocked url: {:s}".format(url)
)
try:
resp = requests.get(
url,