MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / main

Function main

runserver.py:92–287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90
91
92def main():
93 # Patch threading to make exceptions catchable
94 install_thread_excepthook()
95
96 # Make sure exceptions get logged
97 sys.excepthook = handle_exception
98
99 args = get_args()
100
101 # Check for depreciated argumented
102 if args.debug:
103 log.warning('--debug is depreciated. Please use --verbose instead. Enabling --verbose')
104 args.verbose = 'nofile'
105
106 # Add file logging if enabled
107 if args.verbose and args.verbose != 'nofile':
108 filelog = logging.FileHandler(args.verbose)
109 filelog.setFormatter(logging.Formatter('%(asctime)s [%(threadName)16s][%(module)14s][%(levelname)8s] %(message)s'))
110 logging.getLogger('').addHandler(filelog)
111 if args.very_verbose and args.very_verbose != 'nofile':
112 filelog = logging.FileHandler(args.very_verbose)
113 filelog.setFormatter(logging.Formatter('%(asctime)s [%(threadName)16s][%(module)14s][%(levelname)8s] %(message)s'))
114 logging.getLogger('').addHandler(filelog)
115
116 # Check if we have the proper encryption library file and get its path
117 encryption_lib_path = get_encryption_lib_path(args)
118 if encryption_lib_path is "":
119 sys.exit(1)
120
121 if args.verbose or args.very_verbose:
122 log.setLevel(logging.DEBUG)
123 else:
124 log.setLevel(logging.INFO)
125
126 # Let's not forget to run Grunt / Only needed when running with webserver
127 if not args.no_server:
128 if not os.path.exists(os.path.join(os.path.dirname(__file__), 'static/dist')):
129 log.critical('Missing front-end assets (static/dist) -- please run "npm install && npm run build" before starting the server')
130 sys.exit()
131
132 # These are very noisey, let's shush them up a bit
133 logging.getLogger('peewee').setLevel(logging.INFO)
134 logging.getLogger('requests').setLevel(logging.WARNING)
135 logging.getLogger('pgoapi.pgoapi').setLevel(logging.WARNING)
136 logging.getLogger('pgoapi.rpc_api').setLevel(logging.INFO)
137 logging.getLogger('werkzeug').setLevel(logging.ERROR)
138
139 config['parse_pokemon'] = not args.no_pokemon
140 config['parse_pokestops'] = not args.no_pokestops
141 config['parse_gyms'] = not args.no_gyms
142
143 # Turn these back up if debugging
144 if args.verbose or args.very_verbose:
145 logging.getLogger('pgoapi').setLevel(logging.DEBUG)
146 if args.very_verbose:
147 logging.getLogger('peewee').setLevel(logging.DEBUG)
148 logging.getLogger('requests').setLevel(logging.DEBUG)
149 logging.getLogger('pgoapi.pgoapi').setLevel(logging.DEBUG)

Callers 1

runserver.pyFile · 0.70

Calls 12

set_current_locationMethod · 0.95
set_search_controlMethod · 0.95
set_location_queueMethod · 0.95
get_argsFunction · 0.90
get_encryption_lib_pathFunction · 0.90
PogomClass · 0.90
init_databaseFunction · 0.90
drop_tablesFunction · 0.90
create_tablesFunction · 0.90
check_proxiesFunction · 0.90

Tested by

no test coverage detected