refactoring
This commit is contained in:
parent
294231dd48
commit
9a15f6c031
|
|
@ -1,9 +1,7 @@
|
|||
from ast import alias
|
||||
from dis import Instruction
|
||||
import db
|
||||
import sys
|
||||
from recipe_graph import db
|
||||
import re
|
||||
from sqlalchemy import select, desc, exists, not_, except_
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
import bs4
|
||||
from urllib.request import urlopen
|
||||
|
|
@ -129,7 +127,7 @@ def parse_recipe(session, recipe, site):
|
|||
|
||||
return recipe
|
||||
|
||||
|
||||
def main():
|
||||
parser = ArgumentParser(description="Scrape a recipe site for recipies")
|
||||
parser.add_argument('site',
|
||||
help='Name of site')
|
||||
|
|
@ -139,7 +137,7 @@ parser.add_argument('-a', '--auto', action='store', dest='n',
|
|||
help='automaticaly generate identifier(must supply number of recipies to scrape)')
|
||||
parser.add_argument('-v', '--verbose', action='store_true')
|
||||
|
||||
args = parser.parse_args()
|
||||
args = parser.parse_args(sys.argv)
|
||||
if args.verbose:
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
|
||||
|
|
@ -188,3 +186,5 @@ with S.begin() as sess:
|
|||
continue
|
||||
|
||||
|
||||
if __name__ == "__main__": # pragma: no cover
|
||||
main()
|
||||
Loading…
Reference in New Issue