If the site that you are trying to load data from does not have CORS enabled, or only supports HTTP (not HTTPS), you might yet be able to load it via a CORS proxy such as CORS Anywhere.
For example, if your URL is:
Then you’ll get a
TypeError: Failed to fetch if you try to load it:
data = d3.text("https://google.com/robots.txt")
To load it via CORS, prepend the cors-anywhere demo server domain to the URL:
This will now succeed:
data = d3.text("https://cors-anywhere.herokuapp.com/https://google.com/robots.txt")
However, you shouldn’t publish a notebook that uses CORS Anywhere to load data; only use it locally for testing purposes. Per the CORS anywhere documentation:
This server is only provided so that you can easily and quickly try out CORS Anywhere. To ensure that the service stays available to everyone, the number of requests per period is limited, except for requests from some explicitly whitelisted origins.
If you expect lots of traffic, please host your own instance of CORS Anywhere, and make sure that the CORS Anywhere server only whitelists your site to prevent others from using your instance of CORS Anywhere as an open proxy.
If your data is static, one option is to download it and host it on GitHub Gist as described in the Introduction to Data tutorial.