Skip to content
Snippets Groups Projects
Commit 8cbdd251 authored by Constance de Quatrebarbes's avatar Constance de Quatrebarbes
Browse files

Add dares_to_source_data + settings: download xls* files and html source pages

parent 31e756e7
No related branches found
No related tags found
1 merge request!1Implement download script and more
...@@ -72,12 +72,11 @@ def main(): ...@@ -72,12 +72,11 @@ def main():
# #reset the repo by changing remote url of the git and push ? # #reset the repo by changing remote url of the git and push ?
# pass # pass
for cat in TOP_CATEGORIES: for cat in TOP_CATEGORIES:
# print(cat)
url = os.path.join(SOURCE_FILES_URL, cat["page_slug"]) url = os.path.join(SOURCE_FILES_URL, cat["page_slug"])
resp = requests.get(url) resp = requests.get(url)
assert resp is not None, "requests.get() failed with url entrypoint %s" %url assert resp is not None, "requests.get() failed with url entrypoint %s" %url
assert resp.status_code in range(200, 399), "requests response.status_code == %s" %resp.status_code assert resp.status_code in range(200, 399), "requests response.status_code == %s" %resp.status_code
# download html source_file on it's page-slug # download html source_file based one page-slug declared in SETTINGS
html_file_path = os.path.join(target_dir, cat["page_slug"]+".html") html_file_path = os.path.join(target_dir, cat["page_slug"]+".html")
with open(html_file_path, "w") as html_file: with open(html_file_path, "w") as html_file:
html_file.write(resp.text) html_file.write(resp.text)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment