diff --git a/bin/download b/bin/download index 9694e62..2af5274 100755 --- a/bin/download +++ b/bin/download @@ -5,12 +5,11 @@ require 'rest-client' require 'json' require 'pp' -morph_api_url = 'https://api.morph.io/adrianshort/inlink-scraper/data.json' - -result = RestClient.get(morph_api_url, params: { +result = RestClient.get(ENV['MORPH_API_URL'], params: { key: ENV['MORPH_API_KEY'], query: "select * from applications" }) apps = JSON.parse(result) -ScraperWiki.save_sqlite(['authority_name', 'council_reference'], apps, 'applications') +ScraperWiki.save_sqlite( \ + ['authority_name', 'council_reference'], apps, 'applications') diff --git a/netlify.toml b/netlify.toml index 8d83e70..3be8c57 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,7 +4,8 @@ command = "bundle exec bin/download && bundle exec bin/petrify" [template] - incoming-hooks = ["Morph"] + incoming-hooks = ["Morph scrape completed"] [template.environment] - MORPH_API_KEY = "change me" + MORPH_API_KEY = "Your secret Morph API key" + MORPH_API_URL = "https://api.morph.io/adrianshort/inlink-scraper/data.json"