Skip to content

Commit

Permalink
run pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
leigh-johnson committed Aug 10, 2023
1 parent b217ba9 commit dd4d9fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
"--fix",
"--ignore-path",
".gitignore",
"ui/",
"src/",
]

- repo: https://github.com/asottile/pyupgrade
Expand Down
15 changes: 9 additions & 6 deletions dsf/http_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@
from dsf.http import HttpEndpointConnection, HttpEndpointType


async def get_connection_status(http_endpoint_connection: HttpEndpointConnection):
await http_endpoint_connection.read_request()
await http_endpoint_connection.send_response(200, "ok")
http_endpoint_connection.close()
async def get_connection_status(endpoint: HttpEndpointConnection):
await endpoint.read_request()
await endpoint.send_response(200, "ok")
endpoint.close()


def register_http_endpoints():
cmd_conn = CommandConnection(debug=True)
cmd_conn.connect()

# Register the connection status endpoint
endpoint = cmd_conn.add_http_endpoint(HttpEndpointType.GET, "printnanny", "connection-status")
endpoint = cmd_conn.add_http_endpoint(
HttpEndpointType.GET, "printnanny", "connection-status"
)
# Register the handler to reply on requests
endpoint.set_endpoint_handler(get_connection_status)

hostname = socket.gethostname()
print(f"Connection status available from http://{hostname}/machine/printnanny/connection-status")
url = f"http://{hostname}/machine/printnanny/connection-status"
print(f"Connection status available from {url}")

return cmd_conn, endpoint
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.0

0 comments on commit dd4d9fd

Please sign in to comment.