7620: Start removing dependencies on requests (#7643)

* 7620: Start removing dependencies on requests

* Patch urllib.request.urlopen instead of requests.get

* Try to fix flake8

* More work on flake8 import errors

* First attempt at using urllib with cookies

* Fix pylint/flake8

* Fix test_deliver_slice_csv_attachment

* Fix test_deliver_slice_csv_inline

* Import requests and pydruid conditionally, remove dependency on prison

* Fix flake errors

* Fix load_examples

* Please flake

* Skip tests depending on optional deps

* Try to please flake

* Address review comments

* Remove Druid-related UI

* Revert "Remove Druid-related UI"

This reverts commit d7e0f166cc3f3dd2496b4a666e177f0c191aeb0f.

* Skip a few tests more

* Put imports in right order

* Apply black patch

* Please flake

* Please black, silence flake

* Use flake8 silencing the right way

* Add deps for CI
This commit is contained in:
Gianluca Ciccarelli
2019-08-02 20:01:28 +03:00
committed by Maxime Beauchemin
parent cbac428b28
commit e23920b8ba
13 changed files with 249 additions and 82 deletions

View File

@@ -18,10 +18,10 @@
import json
import logging
from urllib import request
from urllib.error import URLError
from celery.utils.log import get_task_logger
import requests
from requests.exceptions import RequestException
from sqlalchemy import and_, func
from superset import app, db
@@ -282,9 +282,9 @@ def cache_warmup(strategy_name, *args, **kwargs):
for url in strategy.get_urls():
try:
logger.info(f"Fetching {url}")
requests.get(url)
request.urlopen(url)
results["success"].append(url)
except RequestException:
except URLError:
logger.exception("Error warming up cache!")
results["errors"].append(url)