-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use async when doing requests - Added more tests
- Loading branch information
Showing
4 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
import argparse | ||
import asyncio | ||
|
||
from japan_avg_hotel_price_finder.configure_logging import configure_logging_with_file | ||
from japan_avg_hotel_price_finder.utils import check_in_db_if_all_date_was_scraped, \ | ||
check_in_csv_dir_if_all_date_was_scraped | ||
|
||
logger = configure_logging_with_file('jp_hotel_data.log', 'jp_hotel_data') | ||
|
||
parser = argparse.ArgumentParser(description='Parser that control which kind of missing dates checkers to use.') | ||
parser.add_argument('--check_db', type=str, default=False, help='Check missing dates in database') | ||
parser.add_argument('--check_csv', type=str, default=False, help='Check missing dates in CSV file directory') | ||
|
||
args = parser.parse_args() | ||
|
||
if args.check_db: | ||
db = args.check_db | ||
check_in_db_if_all_date_was_scraped(db=db, to_sqlite=True) | ||
elif args.check_csv: | ||
directory = args.check_csv | ||
directory = str(directory) | ||
check_in_csv_dir_if_all_date_was_scraped(directory) | ||
else: | ||
logger.warning('Please use --check_db or --check_csv') | ||
|
||
async def check_missing_dates_main(): | ||
parser = argparse.ArgumentParser(description='Parser that control which kind of missing dates checkers to use.') | ||
parser.add_argument('--check_db', type=str, default=False, help='Check missing dates in database') | ||
parser.add_argument('--check_csv', type=str, default=False, help='Check missing dates in CSV file directory') | ||
|
||
args = parser.parse_args() | ||
|
||
if args.check_db: | ||
db = args.check_db | ||
await check_in_db_if_all_date_was_scraped(db=db, to_sqlite=True) | ||
elif args.check_csv: | ||
directory = args.check_csv | ||
directory = str(directory) | ||
await check_in_csv_dir_if_all_date_was_scraped(directory) | ||
else: | ||
logger.warning('Please use --check_db or --check_csv') | ||
|
||
|
||
if __name__ == '__main__': | ||
asyncio.run(check_missing_dates_main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters