Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions datapusher/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
'resource_update': '{ckan_url}/api/action/resource_update'
}

BLACKLIST = web.app.config.get('BLACKLIST_URLS', '').split(' ')

class HTTPError(util.JobError):
"""Exception that's raised if a job fails due to an HTTP problem."""
Expand Down Expand Up @@ -351,6 +352,12 @@ def push_to_datastore(task_id, input, dry_run=False):
raise util.JobError(
'Only http, https, and ftp resources may be fetched.'
)

for black_url in BLACKLIST:
if black_url and black_url in url:
raise util.JobError(
'Resouce can not be fetched - Given URL is blacklisted: %s' % url
)

# fetch the resource data
logger.info('Fetching from: {0}'.format(url))
Expand Down