Repository: python-visualization/folium

Issue:
Remove use of rawgit
Rawgit is being deprecated: https://rawgit.com/

We cannot use it for new URL's and have to stop using it for current ones and move to other CDN's before October 2019.

Currently there are 13 places where we use Rawgit:
https://github.com/python-visualization/folium/search?q=rawgit&unscoped_q=rawgit

Discussion:
ocefpaf: @jtbaker I'm not sure you meant for all those commits, right?
Conengmo: @jtbaker the xml's ended up being committed again :)  Can you remove them? After that I'll add a changelog entry and merge. Thanks for making this PR!

By the way, what do you use to do git stuff? If you'd like we could maybe share our workflows, see what can be improved.
ocefpaf: > By the way, what do you use to do git stuff? If you'd like we could maybe share our workflows, see what can be improved.

That is a good question! I'm a big fan of fork-branch-PR. Sometimes I don't even have a master on my fork so I'm forced to always fetch the latest master-dev and branch from there when adding a new feature or fixing a bug.

PS: would you two be available for a live meeting to discuss that and more about `folium`?
Conengmo: I removed the xmls and added a line to the changelog. Good to merge IMO.

> would you two be available for a live meeting to discuss that and more about folium?

That would be nice! What's a good channel to set this up, Gitter? I should check more often or enable notifications then.

Patch:
diff --git a/.gitignore b/.gitignore
index 42ecb965..677e7b15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,9 @@ dist/
 docs/_build/
 docs/quickstart.ipynb
 examples/results/*
+.cache/
+.idea/
+/*.xml
+/codestyles/*.xml
+/_mac/*.xml
+/inspection/*.xml
diff --git a/CHANGES.txt b/CHANGES.txt
index 0cb937ce..dcfd43a1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,7 @@
 - More options (tms, opacity, kwargs) in TileLayer (mpickering #948)
 - Add MousePosition plugin (btozer #916)
 - Add Minimap plugin (talbertc-usgs #968)
+- Replace Rawgit CDN with Githack (jtbaker #1002)
 
 Bug Fixes
 
diff --git a/folium/folium.py b/folium/folium.py
index 183ee3b7..f79cbfd3 100644
--- a/folium/folium.py
+++ b/folium/folium.py
@@ -47,7 +47,7 @@ _default_css = [
     ('awesome_markers_css',
      'https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css'),  # noqa
     ('awesome_rotate_css',
-     'https://rawgit.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css'),  # noqa
+     'https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css'),  # noqa
     ]
 
 
diff --git a/folium/plugins/beautify_icon.py b/folium/plugins/beautify_icon.py
index 0e5243c2..09d7709d 100644
--- a/folium/plugins/beautify_icon.py
+++ b/folium/plugins/beautify_icon.py
@@ -86,9 +86,9 @@ class BeautifyIcon(MacroElement):
         assert isinstance(figure, Figure), ('You cannot render this Element '
                                             'if it is not in a Figure.')
         figure.header.add_child(
-            CssLink('https://cdn.rawgit.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.css'),  # noqa
+            CssLink('https://rawcdn.githack.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.css'),  # noqa
             name='beautify_icon_css')
 
         figure.header.add_child(
-            JavascriptLink('https://cdn.rawgit.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.js'),  # noqa
+            JavascriptLink('https://rawcdn.githack.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.js'),  # noqa
             name='beautify_icon_js')
diff --git a/folium/plugins/heat_map_withtime.py b/folium/plugins/heat_map_withtime.py
index 04cc7211..fe6cd145 100644
--- a/folium/plugins/heat_map_withtime.py
+++ b/folium/plugins/heat_map_withtime.py
@@ -162,16 +162,16 @@ class HeatMapWithTime(Layer):
                                             'if it is not in a Figure.')
 
         figure.header.add_child(
-            JavascriptLink('https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'),  # noqa
+            JavascriptLink('https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'),  # noqa
             name='leaflet.timedimension.min.js')
 
         figure.header.add_child(
             JavascriptLink(
-                'https://rawgit.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js'),  # noqa
+                'https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js'),  # noqa
             name='heatmap.min.js')
 
         figure.header.add_child(
-            JavascriptLink('https://rawgit.com/pa7/heatmap.js/develop/plugins/leaflet-heatmap/leaflet-heatmap.js'),  # noqa
+            JavascriptLink('https://rawcdn.githack.com/pa7/heatmap.js/develop/plugins/leaflet-heatmap/leaflet-heatmap.js'),  # noqa
             name='leaflet-heatmap.js')
 
         figure.header.add_child(
diff --git a/folium/plugins/measure_control.py b/folium/plugins/measure_control.py
index d3cd1f6f..cfa49104 100644
--- a/folium/plugins/measure_control.py
+++ b/folium/plugins/measure_control.py
@@ -60,7 +60,7 @@ class MeasureControl(MacroElement):
                                             'if it is not in a Figure.')
 
         figure.header.add_child(
-            JavascriptLink('https://cdn.rawgit.com/ljagis/leaflet-measure/2.1.7/dist/leaflet-measure.js'))  # noqa
+            JavascriptLink('https://rawcdn.githack.com/ljagis/leaflet-measure/2.1.7/dist/leaflet-measure.js'))  # noqa
 
         figure.header.add_child(
-            CssLink('https://cdn.rawgit.com/ljagis/leaflet-measure/2.1.7/dist/leaflet-measure.css'))  # noqa
+            CssLink('https://rawcdn.githack.com/ljagis/leaflet-measure/2.1.7/dist/leaflet-measure.css'))  # noqa
diff --git a/folium/plugins/mouse_position.py b/folium/plugins/mouse_position.py
index 3d42f5bb..04f79d76 100644
--- a/folium/plugins/mouse_position.py
+++ b/folium/plugins/mouse_position.py
@@ -81,6 +81,6 @@ class MousePosition(MacroElement):
         assert isinstance(figure, Figure), ('You cannot render this Element '
                                             'if it is not in a Figure.')
 
-        figure.header.add_child(JavascriptLink('https://cdn.rawgit.com/ardhi/Leaflet.MousePosition/c32f1c84/src/L.Control.MousePosition.js'))  # noqa
+        figure.header.add_child(JavascriptLink('https://rawcdn.githack.com/ardhi/Leaflet.MousePosition/c32f1c84/src/L.Control.MousePosition.js'))  # noqa
 
-        figure.header.add_child(CssLink('https://cdn.rawgit.com/ardhi/Leaflet.MousePosition/c32f1c84/src/L.Control.MousePosition.css'))  # noqa
+        figure.header.add_child(CssLink('https://rawcdn.githack.com/ardhi/Leaflet.MousePosition/c32f1c84/src/L.Control.MousePosition.css'))  # noqa
diff --git a/folium/plugins/polyline_text_path.py b/folium/plugins/polyline_text_path.py
index a48682a4..4cf8e2b2 100644
--- a/folium/plugins/polyline_text_path.py
+++ b/folium/plugins/polyline_text_path.py
@@ -79,5 +79,5 @@ class PolyLineTextPath(MacroElement):
                                             'if it is not in a Figure.')
 
         figure.header.add_child(
-            JavascriptLink("https://rawgit.com/makinacorpus/Leaflet.TextPath/leaflet0.8-dev/leaflet.textpath.js"),  # noqa
+            JavascriptLink("https://rawcdn.githack.com/makinacorpus/Leaflet.TextPath/leaflet0.8-dev/leaflet.textpath.js"),  # noqa
             name='polylinetextpath')
diff --git a/folium/plugins/timestamped_geo_json.py b/folium/plugins/timestamped_geo_json.py
index 26604ec7..20699a70 100644
--- a/folium/plugins/timestamped_geo_json.py
+++ b/folium/plugins/timestamped_geo_json.py
@@ -180,11 +180,11 @@ class TimestampedGeoJson(MacroElement):
             name='jqueryui1.10.2')
 
         figure.header.add_child(
-            JavascriptLink('https://rawgit.com/nezasa/iso8601-js-period/master/iso8601.min.js'),  # noqa
+            JavascriptLink('https://rawcdn.githack.com/nezasa/iso8601-js-period/master/iso8601.min.js'),  # noqa
             name='iso8601')
 
         figure.header.add_child(
-            JavascriptLink('https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'),  # noqa
+            JavascriptLink('https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'),  # noqa
             name='leaflet.timedimension')
 
         figure.header.add_child(
@@ -192,7 +192,7 @@ class TimestampedGeoJson(MacroElement):
             name='highlight.js_css')
 
         figure.header.add_child(
-            CssLink("https://cdn.rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css"),  # noqa
+            CssLink("https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css"),  # noqa
             name='leaflet.timedimension_css')
 
         figure.header.add_child(
diff --git a/folium/plugins/timestamped_wmstilelayer.py b/folium/plugins/timestamped_wmstilelayer.py
index 07e70899..aaa0d152 100644
--- a/folium/plugins/timestamped_wmstilelayer.py
+++ b/folium/plugins/timestamped_wmstilelayer.py
@@ -135,11 +135,11 @@ class TimestampedWmsTileLayers(Layer):
             name='jqueryui1.10.2')
 
         figure.header.add_child(
-            JavascriptLink('https://rawgit.com/nezasa/iso8601-js-period/master/iso8601.min.js'),  # noqa
+            JavascriptLink('https://rawcdn.githack.com/nezasa/iso8601-js-period/master/iso8601.min.js'),  # noqa
             name='iso8601')
 
         figure.header.add_child(
-            JavascriptLink('https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'),  # noqa
+            JavascriptLink('https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'),  # noqa
             name='leaflet.timedimension')
 
         figure.header.add_child(
diff --git a/folium/templates/fol_template.html b/folium/templates/fol_template.html
index ea7af831..58eb1e9e 100644
--- a/folium/templates/fol_template.html
+++ b/folium/templates/fol_template.html
@@ -11,7 +11,7 @@
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
-    <link rel="stylesheet" href="https://rawgit.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css"/>
+    <link rel="stylesheet" href="https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css"/>
     <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
     <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
 


Test patch:
diff --git a/tests/plugins/test_beautify_icon.py b/tests/plugins/test_beautify_icon.py
index b9ba88b9..2af4448a 100644
--- a/tests/plugins/test_beautify_icon.py
+++ b/tests/plugins/test_beautify_icon.py
@@ -43,11 +43,11 @@ def test_beautify_icon():
     out = m._parent.render()
 
     # We verify that the script import is present.
-    script = '<script src="https://cdn.rawgit.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.js"></script>'  # noqa
+    script = '<script src="https://rawcdn.githack.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.js"></script>'  # noqa
     assert script in out
 
     # We verify that the css import is present.
-    css = '<link rel="stylesheet" href="https://cdn.rawgit.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.css"/>'  # noqa
+    css = '<link rel="stylesheet" href="https://rawcdn.githack.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.css"/>'  # noqa
     assert css in out
 
     # We verify that the Beautiful Icons are rendered correctly.
diff --git a/tests/plugins/test_heat_map_withtime.py b/tests/plugins/test_heat_map_withtime.py
index a33e3f52..4fb9323b 100644
--- a/tests/plugins/test_heat_map_withtime.py
+++ b/tests/plugins/test_heat_map_withtime.py
@@ -34,11 +34,11 @@ def test_heat_map_with_time():
     out = m._parent.render()
 
     # We verify that the script imports are present.
-    script = '<script src="https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js"></script>'  # noqa
+    script = '<script src="https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js"></script>'  # noqa
     assert script in out
-    script = '<script src="https://rawgit.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js"></script>'  # noqa
+    script = '<script src="https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js"></script>'  # noqa
     assert script in out
-    script = '<script src="https://rawgit.com/pa7/heatmap.js/develop/plugins/leaflet-heatmap/leaflet-heatmap.js"></script>'  # noqa
+    script = '<script src="https://rawcdn.githack.com/pa7/heatmap.js/develop/plugins/leaflet-heatmap/leaflet-heatmap.js"></script>'  # noqa
     assert script in out
     script = '<link rel="stylesheet" href="http://apps.socib.es/Leaflet.TimeDimension/dist/leaflet.timedimension.control.min.css"/>'  # noqa
     assert script in out
diff --git a/tests/plugins/test_polyline_text_path.py b/tests/plugins/test_polyline_text_path.py
index 1292b065..6c305619 100644
--- a/tests/plugins/test_polyline_text_path.py
+++ b/tests/plugins/test_polyline_text_path.py
@@ -49,7 +49,7 @@ def test_polyline_text_path():
     out = m._parent.render()
 
     # We verify that the script import is present.
-    script = '<script src="https://rawgit.com/makinacorpus/Leaflet.TextPath/leaflet0.8-dev/leaflet.textpath.js"></script>'  # noqa
+    script = '<script src="https://rawcdn.githack.com/makinacorpus/Leaflet.TextPath/leaflet0.8-dev/leaflet.textpath.js"></script>'  # noqa
     assert script in out
 
     # We verify that the script part is correct.
diff --git a/tests/plugins/test_timestamped_geo_json.py b/tests/plugins/test_timestamped_geo_json.py
index 1727315b..0bfd9ea7 100644
--- a/tests/plugins/test_timestamped_geo_json.py
+++ b/tests/plugins/test_timestamped_geo_json.py
@@ -102,10 +102,10 @@ def test_timestamped_geo_json():
     # Verify the imports.
     assert '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>' in out
     assert '<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>' in out
-    assert '<script src="https://rawgit.com/nezasa/iso8601-js-period/master/iso8601.min.js"></script>' in out
-    assert '<script src="https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js"></script>' in out  # noqa
+    assert '<script src="https://rawcdn.githack.com/nezasa/iso8601-js-period/master/iso8601.min.js"></script>' in out
+    assert '<script src="https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js"></script>' in out  # noqa
     assert '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css"/>' in out  # noqa
-    assert '<link rel="stylesheet" href="https://cdn.rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css"/>' in out  # noqa
+    assert '<link rel="stylesheet" href="https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css"/>' in out  # noqa
     assert '<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>' in out
 
     # Verify that the script is okay.