|
@@ -0,0 +1,24 @@
|
|
|
|
+from asyncio.subprocess import PIPE
|
|
|
|
+import os
|
|
|
|
+import subprocess
|
|
|
|
+from subprocess import Popen
|
|
|
|
+from db_utils import get_documents
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def main(PATH):
|
|
|
|
+ itr = 0
|
|
|
|
+ for document in get_documents():
|
|
|
|
+ url = document.url
|
|
|
|
+ args = ["wget", "-r", "-l", "1", "-p", "-P", PATH, url]
|
|
|
|
+ Popen(args, stdout=PIPE)
|
|
|
|
+ itr += 1
|
|
|
|
+ if itr == 1:
|
|
|
|
+ break
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+if __name__ == "__main__":
|
|
|
|
+ HOME_DIR = os.path.expanduser("~")
|
|
|
|
+ BASE_DIR = "Code/pdf_parser/document_download_from_server"
|
|
|
|
+
|
|
|
|
+ PATH = os.path.join(HOME_DIR, BASE_DIR)
|
|
|
|
+ main(PATH)
|