@@ -10,7 +10,7 @@ def cli_set_arguments():
10
10
parser = argparse .ArgumentParser (description = "Scrap data from thingiverse" )
11
11
parser .add_argument ('type' , type = str , metavar = '{Thing, Make, User, Remix, APIs, All}' ,
12
12
help = 'Type of data to scrap' , default = 'Thing' )
13
- parser .add_argument ('-I' , '--Interactive' , help = 'Opens program in interactive mode' , action = 'store_true' )
13
+ # parser.add_argument('-I', '--Interactive', help='Opens program in interactive mode', action='store_true')
14
14
parser .add_argument ('-n' , '--num_items' , help = 'How many items to scrape' , type = int , default = 500 )
15
15
parser .add_argument ('-N' , '--Name' , help = 'change name of save file (for local save)' ,
16
16
type = str , default = pconf .def_save_name )
@@ -19,13 +19,10 @@ def cli_set_arguments():
19
19
parser .add_argument ('-D' , '--Driver' , help = 'Driver path (for salenium)' ,
20
20
type = str , default = pconf .driver_path )
21
21
parser .add_argument ('-J' , '--save-json' , help = 'save a copy of results as a json file' , action = 'store_true' )
22
- # TODO: implement different search parameters
23
- parser .add_argument ('-O' , '--Order-parameter' , metavar = '{Test1, Test2}' ,
24
- help = 'The order of things on the search page' , default = 'Test1' )
25
22
parser .add_argument ('-S' , '--pre-search' , type = int , default = 0 ,
26
23
help = 'When scraping for a non-thing type object can first scrape for things, and then scrape '
27
24
'for data based on result. Please provide number of pages to scrape' )
28
- parser .add_argument ('-V ' , '--volume' , type = int , default = 0 ,
25
+ parser .add_argument ('-v ' , '--volume' , type = int , default = 0 ,
29
26
help = 'Set how much info is printed out: '
30
27
'10 = quite, '
31
28
'20 = normal, '
@@ -34,23 +31,18 @@ def cli_set_arguments():
34
31
parser .add_argument ('--google-app-name' , help = 'google developer code used to access google APIs' ,
35
32
type = str , default = pconf .google_ktree_API_key )
36
33
37
- gr_volume = parser .add_mutually_exclusive_group ()
38
- # volume of CLI output
39
- gr_volume .add_argument ('-q' , '--quiet' , help = 'Print quiet' , action = 'store_true' )
40
- gr_volume .add_argument ('-v' , '--verbose' , help = 'Print verbose' , action = 'store_true' )
41
-
42
34
gr_data = parser .add_mutually_exclusive_group ()
43
35
# where to load data from at the start of the run
44
36
gr_data .add_argument ('-j' , '--load-json' , help = 'loads a json save file' , action = 'store_true' )
45
- gr_data .add_argument ('-d' , '--load-db' , help = '(el) Loads json save' , action = 'store_true' )
37
+ # gr_data.add_argument('-d', '--load-db', help='(el) Loads json save', action='store_true')
46
38
47
- gr_db = parser .add_mutually_exclusive_group ()
48
- # how to save results to db
49
- gr_db .add_argument ('-u' , '--update' , help = 'replace duplicates' , action = 'store_true' )
50
- gr_db .add_argument ('-a' , '--append' , help = 'ignore duplicates' , action = 'store_true' )
51
- gr_db .add_argument ('-p' , '--print' , help = "don't save results to database, just print to screen" ,
52
- action = 'store_true' )
53
- gr_db .add_argument ('--replace' , help = 'delete all data once done scraping, and start anew' , action = 'store_true' )
39
+ # gr_db = parser.add_mutually_exclusive_group()
40
+ # # how to save results to db
41
+ # gr_db.add_argument('-u', '--update', help='replace duplicates', action='store_true')
42
+ # gr_db.add_argument('-a', '--append', help='ignore duplicates', action='store_true')
43
+ # gr_db.add_argument('-p', '--print', help="don't save results to database, just print to screen",
44
+ # action='store_true')
45
+ # gr_db.add_argument('--replace', help='delete all data once done scraping, and start anew', action='store_true')
54
46
return parser
55
47
56
48
@@ -74,9 +66,7 @@ def inter_parser(args=None, parser=None):
74
66
inp ['driver_path' ] = vars (args ).get ("Driver" , pconf .driver_path )
75
67
76
68
inp ['search_type' ] = vars (args ).get ("type" , 'thing' ).lower ()
77
- inp ['volume' ] = 'q' if vars (args ).get ("quiet" , False ) else \
78
- 'v' if vars (args ).get ("verbose" , False ) else \
79
- 'n'
69
+ inp ['volume' ] = vars (args )['volume' ]
80
70
inp ['save_to_db_mode' ] = 'u' if vars (args ).get ("update" , False ) else \
81
71
'a' if vars (args ).get ("append" , False ) else \
82
72
'p' if vars (args ).get ("print" , False ) else \
@@ -85,7 +75,6 @@ def inter_parser(args=None, parser=None):
85
75
'j' if vars (args ).get ("load_json" , False ) else \
86
76
'n'
87
77
inp ['do_save_json' ] = vars (args ).get ("save_json" , False )
88
- inp ['Interactive' ] = vars (args ).get ("Interactive" , False )
89
78
inp ['preliminary_count' ] = vars (args ).get ("pre_search" , 0 ) if inp ['search_type' ] != 'thing' else 0
90
79
inp ['google_app_id' ] = vars (args )['google_app_name' ]
91
80
return inp
0 commit comments