routerscraper


Namerouterscraper JSON
Version 0.3.1 PyPI version JSON
download
home_page
SummaryA python package to interact with different routers
upload_time2023-08-26 10:58:52
maintainer
docs_urlNone
authorfra87
requires_python>=3.7
licenseMIT License Copyright (c) 2022 fra87 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords router scraping scrape harvest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # README

Router Scraper

# Details

This project aims at providing a python package to interact with different
routers.

# Getting started

Import the required class from the `routerscraper` package:

- `fastgate_dn8245f2.py` for the Fastgate Huawei DN8245f2
- `technicolor_tg789vacv2.py` for the Technicolor TG789vac v2
- `tplink_m7000.py` for the TP-Link M7000

The constructor needs the following parameters
- `host`: the hostname (or IP address) of the router
- `user`: the username to log in the router
- `password`: the password to log in the router

Then you can get relevant information with:
- `listDevices()`: get the list of connected devices
- `getSmsList()`: get the list of SMS present on the device

The functions automatically issue a login request if necessary.


## Supported functions

Not all functions are supported by all devices. See table below for supported
functions:

| Function                 | `listDevices()` | `getSmsList()` |
| :----------------------- | :-------------: | :------------: |
| Fastgate Huawei DN8245f2 |        X        |                |
| Technicolor TG789vac v2  |        X        |                |
| TP-Link M7000            |                 |        X       |

## Saving and restoring sessions

It is possible to export the sessions to later restore them; this can be used
to avoid having to login every time.

To do this, you can export the current status through `exportSessionStatus`,
which returns a string (base64 encoded JSON dict) that can be saved. The
`restoreSessionStatus` function restores the status from that string.

# Supported routers

At present the package was tested with the following routers firmwares

- Fastgate Huawei DN8245f2 - software 1.0.1b
- Technicolor TG789vac v2 - software 16.3.7636
- TP-Link M7000 - software 1.0.10 Build 211230 Rel.1026n

# Developer notes

Here are some additional notes for developing the library (not just using it).

## Project layout

- `README.md`: This file
- `README.md.license`: License information for this file
- `pyproject.toml`: Configuration file for build environment
- `setup.py`: Fallback file for editable installs
- `Makefile`: Makefile to help running development scripts
- **src/routerscraper**: Folder with the scraping package
    - `basescraper.py`: Contains the base class implementation
    - `requestscraper.py`: Contains the base class for scrapers using requests
    - `seleniumscraper.py`: Contains the base class for scrapers using Selenium
    - `dataTypes.py`: Module to group data types used in the functions
    - `fastgate_dn8245f2.py`: Contains the implementation for the Fastgate
                              Huawei DN8245f2
    - `technicolor_tg789vacv2.py`: Contains the implementation for the
                                   Technicolor TG789vac v2
    - `tplink_m7000.py`: Contains the implementation for the TP-Link M7000
- **tests**: Folder with the unit tests. Each test file in this folder
             implements tests linked to the corresponding file in the
             **routerscraper** folder; if necessary, helper files group
             functions needed by the corresponding test file. **files_\***
             folder contains files needed by the test files.
             `helpers_common.py` implements some classes useful for all the
             tests.
- **examples**: Folder with example code
    - `fastgate_dn8245f2.py`: Contains an example implementation for the
                              Fastgate Huawei DN8245f2
    - `technicolor_tg789vacv2.py`: Contains an example implementation for the
                                   Technicolor TG789vac v2
    - `tplink_m7000.py`: Contains an example implementation for the TP-Link
                         M7000
- **LICENSES**: Folder with the licenses statements

## Examples

All example scripts behave in the same way. They will connect to the router and
print the list of connected devices (or the received SMS, in the case of the
TP-Link).

Call the script with three parameters:

1. URL of the router
2. USERNAME
3. PASSWORD

## Makefile

For development purposes there is a Makefile to automate the different actions.

The available targets are:

- **all**: Build the package (equal to make dist); this is the goal (i.e.
           target executed when calling make without targets)
- **clean**: Clean the project (removing all the .pyc files)
- **dist**: Build the package (both .tar.gz and .whl archives)
- **deploy**: Upload the package on PyPI
- *.venv/bin/activate*: Target to create the virtual environment
- **create_venv**: Easier to remember PHONY to create the virtual environment
- **clean_venv**: Remove the virtual environment
- **code_review**: Run the commands to review the code (flake8 and reuse)
- **tests**: Run the tests on the library
- **release-tests**: Execute all the checks for a release; this target is
                     automatically executed by the other **release-** targets.
- **release-major**: Release the current version bumping the major index. This
                     target needs that the GIT has no uncommitted changes and
                     must be run from the main branch only.
- **release-minor**: Release the current version bumping the minor index. This
                     target needs that the GIT has no uncommitted changes and
                     must be run from the main branch only.
- **release-patch**: Release the current version bumping the patch index. This
                     target needs that the GIT has no uncommitted changes and
                     must be run from the main branch only.
- **check-git-clean**: Helper recipe that tests if GIT repo is clean
- **check-git-on-main**: Helper recipe that tests if GIT repo is on main branch

Note: **bold** targets are PHONY, *italic* ones are files.

All the operations will happen in a virtual environment. The virtual
environment folder is set in environment variable VENV, which defaults to
*.venv*.

NOTE: if you change the prerequisites in the pyproject.toml, remember to run
`make clean_venv` to recreate the virtual environment with the new data.

## Release procedure

In order to release a new version, everything shall be already committed to the
GIT repo (since the process requires a clean GIT repo); in addition, the repo
shall be on main branch. If this is not true, the process will fail.

After having committed the last modifications, issue the following commands:

    make clean
    make release-XXX

The release target shall be `release-major`, `release-minor` or `release-patch`,
according to which part of the software version shall be increased.

If everything is correct, run `make deploy` to upload the files to PyPI.

## Setup the repository

Clone the repository from
[git@github.com:fra87/RouterScraper.git](git@github.com:fra87/RouterScraper.git)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "routerscraper",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "router,scraping,scrape,harvest",
    "author": "fra87",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/7d/a9/85285843b31e1391bf161a5d4f6db4c30311b938be2262ed905fa8546fc3/routerscraper-0.3.1.tar.gz",
    "platform": null,
    "description": "# README\n\nRouter Scraper\n\n# Details\n\nThis project aims at providing a python package to interact with different\nrouters.\n\n# Getting started\n\nImport the required class from the `routerscraper` package:\n\n- `fastgate_dn8245f2.py` for the Fastgate Huawei DN8245f2\n- `technicolor_tg789vacv2.py` for the Technicolor TG789vac v2\n- `tplink_m7000.py` for the TP-Link M7000\n\nThe constructor needs the following parameters\n- `host`: the hostname (or IP address) of the router\n- `user`: the username to log in the router\n- `password`: the password to log in the router\n\nThen you can get relevant information with:\n- `listDevices()`: get the list of connected devices\n- `getSmsList()`: get the list of SMS present on the device\n\nThe functions automatically issue a login request if necessary.\n\n\n## Supported functions\n\nNot all functions are supported by all devices. See table below for supported\nfunctions:\n\n| Function                 | `listDevices()` | `getSmsList()` |\n| :----------------------- | :-------------: | :------------: |\n| Fastgate Huawei DN8245f2 |        X        |                |\n| Technicolor TG789vac v2  |        X        |                |\n| TP-Link M7000            |                 |        X       |\n\n## Saving and restoring sessions\n\nIt is possible to export the sessions to later restore them; this can be used\nto avoid having to login every time.\n\nTo do this, you can export the current status through `exportSessionStatus`,\nwhich returns a string (base64 encoded JSON dict) that can be saved. The\n`restoreSessionStatus` function restores the status from that string.\n\n# Supported routers\n\nAt present the package was tested with the following routers firmwares\n\n- Fastgate Huawei DN8245f2 - software 1.0.1b\n- Technicolor TG789vac v2 - software 16.3.7636\n- TP-Link M7000 - software 1.0.10 Build 211230 Rel.1026n\n\n# Developer notes\n\nHere are some additional notes for developing the library (not just using it).\n\n## Project layout\n\n- `README.md`: This file\n- `README.md.license`: License information for this file\n- `pyproject.toml`: Configuration file for build environment\n- `setup.py`: Fallback file for editable installs\n- `Makefile`: Makefile to help running development scripts\n- **src/routerscraper**: Folder with the scraping package\n    - `basescraper.py`: Contains the base class implementation\n    - `requestscraper.py`: Contains the base class for scrapers using requests\n    - `seleniumscraper.py`: Contains the base class for scrapers using Selenium\n    - `dataTypes.py`: Module to group data types used in the functions\n    - `fastgate_dn8245f2.py`: Contains the implementation for the Fastgate\n                              Huawei DN8245f2\n    - `technicolor_tg789vacv2.py`: Contains the implementation for the\n                                   Technicolor TG789vac v2\n    - `tplink_m7000.py`: Contains the implementation for the TP-Link M7000\n- **tests**: Folder with the unit tests. Each test file in this folder\n             implements tests linked to the corresponding file in the\n             **routerscraper** folder; if necessary, helper files group\n             functions needed by the corresponding test file. **files_\\***\n             folder contains files needed by the test files.\n             `helpers_common.py` implements some classes useful for all the\n             tests.\n- **examples**: Folder with example code\n    - `fastgate_dn8245f2.py`: Contains an example implementation for the\n                              Fastgate Huawei DN8245f2\n    - `technicolor_tg789vacv2.py`: Contains an example implementation for the\n                                   Technicolor TG789vac v2\n    - `tplink_m7000.py`: Contains an example implementation for the TP-Link\n                         M7000\n- **LICENSES**: Folder with the licenses statements\n\n## Examples\n\nAll example scripts behave in the same way. They will connect to the router and\nprint the list of connected devices (or the received SMS, in the case of the\nTP-Link).\n\nCall the script with three parameters:\n\n1. URL of the router\n2. USERNAME\n3. PASSWORD\n\n## Makefile\n\nFor development purposes there is a Makefile to automate the different actions.\n\nThe available targets are:\n\n- **all**: Build the package (equal to make dist); this is the goal (i.e.\n           target executed when calling make without targets)\n- **clean**: Clean the project (removing all the .pyc files)\n- **dist**: Build the package (both .tar.gz and .whl archives)\n- **deploy**: Upload the package on PyPI\n- *.venv/bin/activate*: Target to create the virtual environment\n- **create_venv**: Easier to remember PHONY to create the virtual environment\n- **clean_venv**: Remove the virtual environment\n- **code_review**: Run the commands to review the code (flake8 and reuse)\n- **tests**: Run the tests on the library\n- **release-tests**: Execute all the checks for a release; this target is\n                     automatically executed by the other **release-** targets.\n- **release-major**: Release the current version bumping the major index. This\n                     target needs that the GIT has no uncommitted changes and\n                     must be run from the main branch only.\n- **release-minor**: Release the current version bumping the minor index. This\n                     target needs that the GIT has no uncommitted changes and\n                     must be run from the main branch only.\n- **release-patch**: Release the current version bumping the patch index. This\n                     target needs that the GIT has no uncommitted changes and\n                     must be run from the main branch only.\n- **check-git-clean**: Helper recipe that tests if GIT repo is clean\n- **check-git-on-main**: Helper recipe that tests if GIT repo is on main branch\n\nNote: **bold** targets are PHONY, *italic* ones are files.\n\nAll the operations will happen in a virtual environment. The virtual\nenvironment folder is set in environment variable VENV, which defaults to\n*.venv*.\n\nNOTE: if you change the prerequisites in the pyproject.toml, remember to run\n`make clean_venv` to recreate the virtual environment with the new data.\n\n## Release procedure\n\nIn order to release a new version, everything shall be already committed to the\nGIT repo (since the process requires a clean GIT repo); in addition, the repo\nshall be on main branch. If this is not true, the process will fail.\n\nAfter having committed the last modifications, issue the following commands:\n\n    make clean\n    make release-XXX\n\nThe release target shall be `release-major`, `release-minor` or `release-patch`,\naccording to which part of the software version shall be increased.\n\nIf everything is correct, run `make deploy` to upload the files to PyPI.\n\n## Setup the repository\n\nClone the repository from\n[git@github.com:fra87/RouterScraper.git](git@github.com:fra87/RouterScraper.git)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 fra87  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A python package to interact with different routers",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://github.com/fra87/RouterScraper"
    },
    "split_keywords": [
        "router",
        "scraping",
        "scrape",
        "harvest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4f77770af02ded9043aacf3323cd2c33465bb812f400000749140ad5b86a8c4",
                "md5": "93b87389e2b3d8f6dc069997375f648c",
                "sha256": "e86ae70ca1775c14d18f520e76125e4d2172f8a983721268494c127ac43e5cea"
            },
            "downloads": -1,
            "filename": "routerscraper-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "93b87389e2b3d8f6dc069997375f648c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 22401,
            "upload_time": "2023-08-26T10:58:51",
            "upload_time_iso_8601": "2023-08-26T10:58:51.468566Z",
            "url": "https://files.pythonhosted.org/packages/d4/f7/7770af02ded9043aacf3323cd2c33465bb812f400000749140ad5b86a8c4/routerscraper-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7da985285843b31e1391bf161a5d4f6db4c30311b938be2262ed905fa8546fc3",
                "md5": "a7d8d737426fa76a0a1ef8d594843d6d",
                "sha256": "a988c6f6b2d92be2f6c58645f342ddd68b507fc06874af800293ec8f2604b838"
            },
            "downloads": -1,
            "filename": "routerscraper-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a7d8d737426fa76a0a1ef8d594843d6d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 26965,
            "upload_time": "2023-08-26T10:58:52",
            "upload_time_iso_8601": "2023-08-26T10:58:52.907476Z",
            "url": "https://files.pythonhosted.org/packages/7d/a9/85285843b31e1391bf161a5d4f6db4c30311b938be2262ed905fa8546fc3/routerscraper-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-26 10:58:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fra87",
    "github_project": "RouterScraper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "routerscraper"
}
        
Elapsed time: 0.11015s