mirror of
https://github.com/cve-search/cpe-guesser.git
synced 2024-11-24 07:47:23 +00:00
chg: [server] configurable port, common exceptions
This commit is contained in:
parent
650e0f7fec
commit
5320323840
1 changed files with 12 additions and 3 deletions
|
@ -7,6 +7,9 @@ import falcon
|
|||
from wsgiref.simple_server import make_server
|
||||
import json
|
||||
|
||||
# Configuration
|
||||
port = 8000
|
||||
|
||||
runPath = os.path.dirname(os.path.realpath(__file__))
|
||||
sys.path.append(os.path.join(runPath, ".."))
|
||||
from lib.cpeguesser import CPEGuesser
|
||||
|
@ -36,6 +39,12 @@ if __name__ == '__main__':
|
|||
app = falcon.App()
|
||||
app.add_route('/search', Search())
|
||||
|
||||
with make_server('', 8000, app) as httpd:
|
||||
print('Serving on port 8000...')
|
||||
httpd.serve_forever()
|
||||
try:
|
||||
with make_server('', port, app) as httpd:
|
||||
print(f"Serving on port {port}...")
|
||||
httpd.serve_forever()
|
||||
except OSError as e:
|
||||
print (e)
|
||||
sys.exit(1)
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(0)
|
||||
|
|
Loading…
Reference in a new issue