Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
Okay lets try this with stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
thieman committed Mar 3, 2016
1 parent 214e179 commit 8e2af4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 8 additions & 5 deletions dusty/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import logging
import socket
import threading
# requests refused to play nicely with pyinstaller
import httplib

from docopt import docopt
import requests

from .preflight import preflight_check, refresh_preflight_warnings
from .log import configure_logging, make_socket_logger, close_socket_logger
Expand Down Expand Up @@ -66,10 +67,12 @@ def close_client_connection(terminator=SOCKET_TERMINATOR):
def shut_down_http_server():
logging.info('Daemon is shutting down HTTP server')
try:
r = requests.post('http://{}:{}/shutdown'.format(constants.DAEMON_HTTP_BIND_IP,
constants.DAEMON_HTTP_BIND_PORT),
timeout=2)
r.raise_for_status()
h = httplib.HTTPConnection('{}:{}'.format(constants.DAEMON_HTTP_BIND_IP,
constants.DAEMON_HTTP_BIND_PORT))
h.request('POST', '/shutdown')
r = h.getresponse()
if r.status != 200:
raise ValueError('Got status code {} from response'.format(r.status))
except Exception as e:
logging.exception('Exception trying to shut down HTTP server')

Expand Down
1 change: 0 additions & 1 deletion requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
'Schemer==0.2.9',
'psutil==2.2.1',
'Flask==0.10.1',
'requests==2.5.1',
]

test_requires = [
Expand Down

0 comments on commit 8e2af4e

Please sign in to comment.