Repository: bokeh/bokeh

Issue:
remove requests as runtime dependency?
This only seems to be used for one sampledata download, in which case we should find a different way to grab the data with stdlib functions and remove the dependency.

ping @mattpap 


Discussion:
There are some other uses:
```
$ git grep "\(import\|from\)\s*requests"
bokeh/command/subcommands/tests/test_serve.py:import requests
bokeh/sampledata/daylight.py:import requests
tests/examples/collect_examples.py:import requests
tests/plugins/bokeh_server.py:import requests
tests/plugins/bokeh_server.py:from requests.exceptions import ConnectionError
tests/plugins/jupyter_notebook.py:import requests
tests/plugins/jupyter_notebook.py:from requests.exceptions import ConnectionError
```
right every other use is a test. I don't mind it being a test dependency, but it should't be a runtime dependency if all it is needed for is `daylight.py` sampledata
Specifically would like to remove from this list:

https://github.com/bokeh/bokeh/blob/master/setup.py#L89-L100

and add to tests section in `meta.yaml`
Tangentially: are numpy and tornado needed as *build* dependencies?
It appears that the ``requests`` usage is deadcode (we've checked in the downloaded csv and don't actually do the download). We should just delete the download function and remove the dep.
+1 

Resolving patch:
diff --git a/bokeh/sampledata/daylight.py b/bokeh/sampledata/daylight.py
--- a/bokeh/sampledata/daylight.py
+++ b/bokeh/sampledata/daylight.py
@@ -7,60 +7,8 @@
 pd = import_required('pandas',
               'daylight sample data requires Pandas (http://pandas.pydata.org) to be installed')
 
-import re
-import datetime
-import requests
-
-from six.moves import xrange
 from os.path import join, abspath, dirname
 
-url = "http://sunrisesunset.com/calendar.asp"
-
-r0 = re.compile("<[^>]+>|&nbsp;|[\r\n\t]")
-r1 = re.compile(r"(\d+)(DST Begins|DST Ends)?Sunrise: (\d+):(\d\d)Sunset: (\d+):(\d\d)")
-
-def fetch_daylight_hours(lat, lon, tz, dst, year):
-    """Fetch daylight hours from sunrisesunset.com for a given location.
-
-       Parameters
-       ----------
-       lat  : float
-           Location's latitude.
-       lon  : float
-           Location's longitude.
-       tz   : int or float
-           Time zone offset from UTC. Use floats for half-hour time zones.
-       dst  : int
-           Daylight saving type, e.g. 0 -> none, 1 -> North America, 2 -> Europe.
-           See sunrisesunset.com/custom.asp for other possible values.
-       year : int
-           Year (1901..2099).
-    """
-    daylight = []
-    summer = 0 if lat >= 0 else 1
-
-    for month in xrange(1, 12+1):
-        args = dict(url=url, lat=lat, lon=lon, tz=tz, dst=dst, year=year, month=month)
-        response = requests.get("%(url)s?comb_city_info=_;%(lon)s;%(lat)s;%(tz)s;%(dst)s&month=%(month)s&year=%(year)s&time_type=1&wadj=1" % args)
-        entries = r1.findall(r0.sub("", response.text))
-
-        for day, note, sunrise_hour, sunrise_minute, sunset_hour, sunset_minute in entries:
-            if note == "DST Begins":
-                summer = 1
-            elif note == "DST Ends":
-                summer = 0
-
-            date = datetime.date(year, month, int(day))
-            sunrise = datetime.time(int(sunrise_hour), int(sunrise_minute))
-            sunset = datetime.time(int(sunset_hour), int(sunset_minute))
-
-            daylight.append([date, sunrise, sunset, summer])
-
-    return pd.DataFrame(daylight, columns=["Date", "Sunrise", "Sunset", "Summer"])
-
-# daylight_warsaw_2013 = fetch_daylight_hours(52.2297, -21.0122, 1, 2, 2013)
-# daylight_warsaw_2013.to_csv("bokeh/sampledata/daylight_warsaw_2013.csv", index=False)
-
 def load_daylight_hours(file):
     path = join(dirname(abspath(__file__)), file)
     df = pd.read_csv(path, parse_dates=["Date", "Sunrise", "Sunset"])
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -88,7 +88,6 @@
 # state our runtime deps here, also used by meta.yaml (so KEEP the spaces)
 REQUIRES = [
     'six >=1.5.2',
-    'requests >=1.2.3',
     'PyYAML >=3.10',
     'python-dateutil >=2.1',
     'Jinja2 >=2.7',


Test patch: