This Flask web application allows users to input a MAC address or serial number of a router and looks it up across multiple NetCloud accounts. The application then returns the account name that the router belongs to.
- Input MAC address or serial number of a router
- Lookup across multiple NetCloud accounts
- Return the account name associated with the router
- Python 3.x
- Flask
- Requests
-
Clone the repository:
git clone https://github.com/cradlepoint/api-samples/tree/master/NetCloud%20Router%20Lookup cd NetCloud\ Router\ Lookup
-
Create a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate -
Install the required packages:
pip install -r requirements.txt
- Update the
named_keyssection of router_lookup.py with your NetCloud Accounts' names and APIv2 Keys.# Dictionary of named keys named_keys = { 'account1': { 'X-ECM-API-ID': '1234567890', 'X-ECM-API-KEY': '0987654321', 'X-CP-API-ID': '1234567890', 'X-CP-API-KEY': '0987654321' }, 'account2': { 'X-ECM-API-ID': '1234567890', 'X-ECM-API-KEY': '0987654321', 'X-CP-API-ID': '1234567890', 'X-CP-API-KEY': '0987654321' }, 'account3': { 'X-ECM-API-ID': '1234567890', 'X-ECM-API-KEY': '0987654321', 'X-CP-API-ID': '1234567890', 'X-CP-API-KEY': '0987654321' } }
-
Run the Flask application:
python3 router_lookup.py
-
Open your web browser and go to
http://127.0.0.1:8000. -
Enter the MAC address or serial number of the router in the input field and click "Lookup".
-
The application will display the account name associated with the router, or an error message if the router is not found.
