Make output dir if it doesn't exist
This commit is contained in:
parent
3a033c01f2
commit
0e581981d1
10
README.org
10
README.org
@ -1,6 +1,6 @@
|
||||
#+OPTIONS: toc:nil
|
||||
|
||||
* SearchApi Automated Browser
|
||||
* Automated Browser
|
||||
|
||||
** Overview
|
||||
|
||||
@ -21,12 +21,18 @@ python orchestrator.py <website> [options]
|
||||
Make sure to have =docker= installed. For python best practices, create a virtual
|
||||
environment and install dependencies:
|
||||
|
||||
#+begin_src bash
|
||||
#+begin_src sh
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
#+end_src
|
||||
|
||||
Also build the container
|
||||
|
||||
#+begin_src sh
|
||||
docker build -t search-api .
|
||||
#+end_src
|
||||
|
||||
*** Arguments
|
||||
|
||||
- =website= (required): The website URL you want to scrape
|
||||
|
@ -40,8 +40,8 @@ env_vars = {
|
||||
|
||||
output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'output')
|
||||
|
||||
# os.makedirs(output_dir, exist_ok=True)
|
||||
# os.chmod(output_dir, 0o777)
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
os.chmod(output_dir, 0o777)
|
||||
|
||||
if args.browser_args:
|
||||
env_vars['BROWSER_ARGS'] = ','.join(args.browser_args)
|
||||
@ -51,7 +51,6 @@ if args.proxy_url:
|
||||
|
||||
try:
|
||||
container_start_time = time.time()
|
||||
print("Container start time:", container_start_time)
|
||||
|
||||
container = docker_client.containers.run(
|
||||
args.image_name,
|
||||
@ -143,7 +142,6 @@ try:
|
||||
subprocess.run(['open', 'output/report.html'])
|
||||
print("Report opened in browser")
|
||||
except (subprocess.CalledProcessError, FileNotFoundError):
|
||||
print("what happened")
|
||||
pass
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user