Skip to content

Commit

Permalink
Add main, remove logging
Browse files Browse the repository at this point in the history
  • Loading branch information
charmoniumQ committed Mar 15, 2022
1 parent 02b461b commit 3eacf07
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ __pycache__/
/.direnv/

/.cache/
*.log
24 changes: 24 additions & 0 deletions ascl_net_scraper/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import logging

from tqdm import tqdm

from .main import scrape_index_list, scrape_details

logger = logging.getLogger("charmonium.freeze")
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler("freeze.log")
fh.setLevel(logging.DEBUG)
fh.setFormatter(logging.Formatter("%(asctime)s: %(message)s"))
logger.addHandler(fh)

logger = logging.getLogger("charmonium.cache.ops")
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler("cache.log")
fh.setLevel(logging.DEBUG)
fh.setFormatter(logging.Formatter("%(asctime)s: %(message)s"))
logger.addHandler(fh)


records = scrape_index_list(10)
for record in tqdm(records, total=len(records)):
detailed_record = scrape_details(record.details_url)
17 changes: 0 additions & 17 deletions ascl_net_scraper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,6 @@
DEFAULT_PARSER = "html5lib"
group = MemoizedGroup(fine_grain_persistence=True)

# import logging

# logger = logging.getLogger("charmonium.freeze")
# logger.setLevel(logging.DEBUG)
# fh = logging.FileHandler("freeze.log")
# fh.setLevel(logging.DEBUG)
# fh.setFormatter(logging.Formatter("%(asctime)s: %(message)s"))
# logger.addHandler(fh)

# logger = logging.getLogger("charmonium.cache.ops")
# logger.setLevel(logging.DEBUG)
# fh = logging.FileHandler("cache.log")
# fh.setLevel(logging.DEBUG)
# fh.setFormatter(logging.Formatter("%(asctime)s: %(message)s"))
# logger.addHandler(fh)


@dataclass
class CodeRecord:
ascl_id: Optional[Tuple[int, int]]
Expand Down

0 comments on commit 3eacf07

Please sign in to comment.