From 098d428ff8de5c0caf233bbc0961f1d58b7be572 Mon Sep 17 00:00:00 2001 From: "Jean-Paul R. Soucy" Date: Fri, 23 Jun 2023 11:28:23 -0400 Subject: [PATCH] Add NS epidemiology report (#291) - URL function only available for Python due to the complexity of the code (requires replacing "legacy_ssl" functionality in the url_fun_python) --- datasets.json | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/datasets.json b/datasets.json index a92dbee0..df378777 100644 --- a/datasets.json +++ b/datasets.json @@ -4063,6 +4063,30 @@ "meta_group_1": "Nova Scotia" }, "notes": {} + }, + { + "id_name": "NS - COVID-19: alerts, news and data - COVID-19 epidemiologic summary (report)", + "uuid": "1bfed24d-51d3-443e-b13f-d36f55ae19d0", + "active": "True", + "url_fun_python": "import requests\nfrom bs4 import BeautifulSoup\nimport re\n\nclass CustomHttpAdapter (requests.adapters.HTTPAdapter):\n def __init__(self, ssl_context=None, **kwargs):\n self.ssl_context = ssl_context\n super().__init__(**kwargs)\n\n def init_poolmanager(self, connections, maxsize, block=False):\n import urllib3\n self.poolmanager = urllib3.poolmanager.PoolManager(\n num_pools=connections, maxsize=maxsize,\n block=block, ssl_context=self.ssl_context)\n\ndef get_legacy_session(custom_session):\n import ssl\n import requests\n ctx = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)\n ctx.options |= 0x4\n session = requests.session()\n session.mount('https://', custom_session(ctx))\n return session\n\nreq = get_legacy_session(CustomHttpAdapter).get('https://novascotia.ca/coronavirus/alerts-notices/', timeout=5)\nurl_current = re.sub('^\\.\\.', 'https://novascotia.ca/coronavirus', BeautifulSoup(req.content).find('a', text=re.compile('^COVID-19 Epidemiologic Summary'))['href'])\n", + "dir_parent": "ns", + "dir_file": "epidemiologic-summary", + "file_name": "COVID-19-epidemiologic-summary", + "file_ext": "pdf", + "dl_fun": "dl_file", + "args": { + "legacy_ssl": "True" + }, + "supplementary": {}, + "metadata": { + "meta_name": "COVID-19 epidemiologic summary", + "meta_url": "https://novascotia.ca/coronavirus/alerts-notices", + "meta_url_name": "COVID-19: alerts, news and data", + "meta_licence": "", + "meta_licence_url": "", + "meta_group_1": "Nova Scotia" + }, + "notes": {} } ], "nt": [],