Skip to content

Commit

Permalink
--interactive no longer resets page, refs #125
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Nov 1, 2023
1 parent 6d340ad commit 3709166
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions shot_scraper/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,16 +990,20 @@ def on_response(response):
if shot.get("height"):
full_page = False

response = page.goto(url)
# Check if page was a 404 or 500 or other error
if str(response.status)[0] in ("4", "5"):
if skip:
click.echo(
"{} error for {}, skipping".format(response.status, url), err=True
)
return
elif fail:
raise click.ClickException("{} error for {}".format(response.status, url))
if not use_existing_page:
# Load page and check for errors
response = page.goto(url)
# Check if page was a 404 or 500 or other error
if str(response.status)[0] in ("4", "5"):
if skip:
click.echo(
"{} error for {}, skipping".format(response.status, url), err=True
)
return
elif fail:
raise click.ClickException(
"{} error for {}".format(response.status, url)
)

if wait:
time.sleep(wait / 1000)
Expand Down

0 comments on commit 3709166

Please sign in to comment.