Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codebase Refactoring for 2.0.0 #10

Open
6 of 13 tasks
JamoDevNich opened this issue Apr 7, 2020 · 1 comment
Open
6 of 13 tasks

Codebase Refactoring for 2.0.0 #10

JamoDevNich opened this issue Apr 7, 2020 · 1 comment

Comments

@JamoDevNich
Copy link
Owner

JamoDevNich commented Apr 7, 2020

Overview

Planning to tidy up the codebase and also take the opportunity to implement some new features 😀. The end goal is to enable the script to also function as a library (rather than only a CLI interface), and to improve maintainablility of the overall codebase.

The project will remain a single python file with no dependencies on external packages, and all of the existing functionality will remain.

Any suggestions/changes/feedback would be much appreciated!

Core Changes

  • Replace the 'web' function with Python's urllib
  • Create Session class to handle logging in/out & SNMP-over-HTTP requests
  • Refactor all classes to inherit a new base class 'APIRequest' Edit: 'RouterSessionClientBase'
  • Create Output class to handle formatting the output in the command line
  • Custom session exceptions - e.g. login failed
  • User input exception - allow an user to input text if running as CLI
  • All global variables removed (except version)

Documentation

  • Custom session exceptions
  • User input exception

New Features and minor changes

  • Check if a user is already logged in
  • Add 'is ethernet/wlan' column to clients list
  • Include data from the base64-encoded login cookie to the diagnostic output
  • Login action now returns HTTP status code 500 if the password is incorrect. Previously this used to be an empty response, could use this to provide a more user-friendly exception.
@aleks-mariusz
Copy link

excited for this! what you have so far is amazing already!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants