Skip to content

Commit

Permalink
update 0.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Will-Liang committed Aug 14, 2023
1 parent df569b2 commit cc918c0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
17 changes: 17 additions & 0 deletions liangutil/liangutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,20 @@ def uncompress(src_file, dest_dir_path):
return True


def find_all_files(directory):
"""根据目录寻找该目录下的所有子文件
Args:
directory(str):目录路径
Returns:
list: 子文件路径
"""
file_paths = []

for root, _, files in os.walk(directory):
for file in files:
file_path = os.path.join(root, file)
file_paths.append(file_path)

return file_paths
5 changes: 4 additions & 1 deletion liangutil/requestutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def get_page_source(self, url, time_sleep=0, retry_count=3, proxy=""):
try:
self.driver.get(url)
except Exception as e:
self.driver.execute("window.stop()")
self.driver.execute_script("window.stop()")
return {"error":e,
"content":"",
"url":url}
Expand All @@ -465,6 +465,9 @@ def get_page_source(self, url, time_sleep=0, retry_count=3, proxy=""):
"content": "",
"url": self.driver.current_url}

return {"error": "",
"content": "",
"url": self.driver.current_url}


def close(self):
Expand Down

0 comments on commit cc918c0

Please sign in to comment.