Skip to content

Commit

Permalink
Add NS epidemiology report (#291)
Browse files Browse the repository at this point in the history
- URL function only available for Python due to the complexity of the code (requires replacing "legacy_ssl" functionality in the url_fun_python)
  • Loading branch information
jeanpaulrsoucy committed Jun 23, 2023
1 parent b1bfde8 commit 098d428
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions datasets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down

0 comments on commit 098d428

Please sign in to comment.