-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup customized logger Update requirements.txt and README.md
- Loading branch information
1 parent
411e850
commit d8031f2
Showing
8 changed files
with
65 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Place holder package""" | ||
|
||
version = "0.0.1" | ||
version = "0.0.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import logging | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
LOGGER.addHandler(logging.StreamHandler()) | ||
_HANDLER = logging.StreamHandler() | ||
_FORMATTER = logging.Formatter('%(asctime)s - %(levelname)s - [%(module)s:%(lineno)d] - %(funcName)s - %(message)s') | ||
_HANDLER.setFormatter(_FORMATTER) | ||
LOGGER.addHandler(_HANDLER) | ||
LOGGER.setLevel(logging.INFO) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import List | ||
|
||
from pynetgear import Device, Netgear | ||
|
||
from netfuse.config import settings, ValidationError | ||
from netfuse.logger import LOGGER | ||
|
||
|
||
def attached_devices() -> List[Device]: | ||
"""Get all attached devices in a Netgear router. | ||
Returns: | ||
List[Device]: | ||
List of device objects. | ||
""" | ||
if not settings.router_pass: | ||
raise ValidationError( | ||
"\n\nrouter_pass\n Input should be a valid string " | ||
f"[type=string_type, input_value={settings.router_pass}, input_type={type(settings.router_pass)}]\n" | ||
) | ||
netgear = Netgear(password=settings.router_pass) | ||
if devices := netgear.get_attached_devices(): | ||
return devices | ||
else: | ||
LOGGER.error("Unable to get attached devices.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
pandas | ||
requests | ||
lxml | ||
click | ||
# required by default | ||
click==8.1.7 | ||
|
||
# FIX ME: Requirements are too generic, make it specific with installation netfuse[att] or netfuse[netgear] | ||
|
||
# required for At&t | ||
pandas==2.1.3 | ||
lxml==4.9.3 | ||
|
||
# required for Netgear users | ||
requests>=2.31.0 | ||
pynetgear==0.10.10 |