Skip to content

Commit

Permalink
refactor(cl_scrape_opinions): renamed variable used in logging
Browse files Browse the repository at this point in the history
  • Loading branch information
grossir committed Aug 21, 2024
1 parent 9d034de commit ace253e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions cl/scrapers/management/commands/cl_back_scrape_citations.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@


class Command(cl_back_scrape_opinions.Command):
scrape_target_descr = "citations"

def scrape_court(
self,
site,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Command(cl_scrape_oral_arguments.Command):
def parse_and_scrape_site(self, mod, full_crawl):
def parse_and_scrape_site(self, mod, options: dict):
court_str = mod.__name__.split(".")[-1].split("_")[0]
logger.info(f'Using court_str: "{court_str}"')

Expand Down
6 changes: 3 additions & 3 deletions cl/scrapers/management/commands/cl_scrape_opinions.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def save_everything(

class Command(VerboseCommand):
help = "Runs the Juriscraper toolkit against one or many jurisdictions."
object_type = "opinions" # for logging purposes
scrape_target_descr = "opinions" # for logging purposes

def __init__(self, stdout=None, stderr=None, no_color=False):
super().__init__(stdout=None, stderr=None, no_color=False)
Expand Down Expand Up @@ -288,7 +288,7 @@ def scrape_court(
if site.cookies:
logger.info("Using cookies: %s", site.cookies)

logger.debug("#%s opinions found.", len(site))
logger.debug("#%s %s found.", len(site), self.scrape_target_descr)

added = 0
for i, item in enumerate(site):
Expand All @@ -313,7 +313,7 @@ def scrape_court(
site.court_id,
added,
len(site),
self.object_type,
self.scrape_target_descr,
)
if not full_crawl:
# Only update the hash if no errors occurred.
Expand Down
6 changes: 4 additions & 2 deletions cl/scrapers/management/commands/cl_scrape_oral_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def make_objects(


class Command(cl_scrape_opinions.Command):
object_type = "oral arguments"
scrape_target_descr = "oral arguments"

def ingest_a_case(
self,
Expand All @@ -132,7 +132,9 @@ def ingest_a_case(
)

logger.info(
"Adding new document found at: %s", item["download_urls"].encode()
"Adding new %s found at: %s",
self.scrape_target_descr,
item["download_urls"].encode(),
)
dup_checker.reset()

Expand Down

0 comments on commit ace253e

Please sign in to comment.