fritzconnection


Namefritzconnection JSON
Version 1.13.2 PyPI version JSON
download
home_pagehttps://github.com/kbr/fritzconnection
SummaryCommunicate with the AVM FRITZ!Box
upload_time2023-09-17 13:12:12
maintainer
docs_urlNone
authorKlaus Bremer
requires_python>= 3.7
licenseMIT
keywords avm fritz!box fritzbox fritz
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            
# fritzconnection

![](https://img.shields.io/pypi/pyversions/fritzconnection.svg)
![](https://img.shields.io/pypi/l/fritzconnection.svg)

Python-Interface to communicate with the AVM Fritz!Box. Supports the TR-064 protocol, the (AHA-)HTTP-Interface and also allows call-monitoring.


## Installation

For installation use pip:

```
    $ pip install fritzconnection
      or
    $ pip install fritzconnection[qr]
```

The latter will install the [segno](https://github.com/heuer/segno) package to enable QR-code creation for wifi login.

## Quickstart

Using fritzconnection is as easy as:

```
    from fritzconnection import FritzConnection

    fc = FritzConnection(address="192.168.178.1", user="user", password="pw")
    print(fc)  # print router model information

    # tr-064 interface: reconnect for a new ip
    fc.call_action("WANIPConn1", "ForceTermination")

    # http interface: gets history data from a device with given 'ain'
    fc.call_http("getbasicdevicestats", "12345 7891011")
```

FritzConnection provides two basic commands to communicate with the router APIs: `call_action()` for the __TR-064-Interface__ and `call_http()` for the __(AHA)-HTTP-Interface__. Both APIs can be used on the same FritzConnection instance side by side.

### call_action

`call_action()` expects a __TR-064__ service- and an action-name (and optional arguments). In general FritzConnection can execute every service and action provided by the (model-specific) API as documented by AVM. For i.e. this can be network settings, status informations, access to home automation devices and much more. The `call_action()` method returns the response from the router as a dictionary with the values already converted to the matching Python datatypes.

### call_http

`call_http()` expects a command for the __http-interface__ like "getbasicdevicestats" and, depending on the command, additional arguments like a device "ain" (identifier). A call to the method returns a dictionary with the `content-type`, the `encoding` and the `response` data of the http-response. The content-type of the response-data is typical "text/plain" or "text/xml" and may need further processing.

### Username and password

To avoid hardcoding the arguments `user` and `password` in applications FritzConnection can read both from the environment variables `FRITZ_USERNAME` and `FRITZ_PASSWORD`.


### Caching

On instanciation FritzConnection has to inspect the model-specific router-API. This causes a lot of network requests and can take some seconds. To avoid this FritzConnection provides a cache that can get activated by the `use_cache` parameter:

```
    fc = FritzConnection(..., use_cache=True)
```

This argument defaults to `False`. After creating the cache FritzConnection will start up much more faster.


## Library


The package comes with library-modules to make some API calls easier and also demonstrates how to implement applications on top of FritzConnection.


## Documentation

The full documentation and release notes are at [https://fritzconnection.readthedocs.org](https://fritzconnection.readthedocs.org)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kbr/fritzconnection",
    "name": "fritzconnection",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">= 3.7",
    "maintainer_email": "",
    "keywords": "AVM FRITZ!Box fritzbox fritz",
    "author": "Klaus Bremer",
    "author_email": "bremer@bremer-media.com",
    "download_url": "https://files.pythonhosted.org/packages/cc/55/d3b75c1c43b69cd7a2c39b47b911a3fe0e65e67f6c1685947169a287253e/fritzconnection-1.13.2.tar.gz",
    "platform": null,
    "description": "\n# fritzconnection\n\n![](https://img.shields.io/pypi/pyversions/fritzconnection.svg)\n![](https://img.shields.io/pypi/l/fritzconnection.svg)\n\nPython-Interface to communicate with the AVM Fritz!Box. Supports the TR-064 protocol, the (AHA-)HTTP-Interface and also allows call-monitoring.\n\n\n## Installation\n\nFor installation use pip:\n\n```\n    $ pip install fritzconnection\n      or\n    $ pip install fritzconnection[qr]\n```\n\nThe latter will install the [segno](https://github.com/heuer/segno) package to enable QR-code creation for wifi login.\n\n## Quickstart\n\nUsing fritzconnection is as easy as:\n\n```\n    from fritzconnection import FritzConnection\n\n    fc = FritzConnection(address=\"192.168.178.1\", user=\"user\", password=\"pw\")\n    print(fc)  # print router model information\n\n    # tr-064 interface: reconnect for a new ip\n    fc.call_action(\"WANIPConn1\", \"ForceTermination\")\n\n    # http interface: gets history data from a device with given 'ain'\n    fc.call_http(\"getbasicdevicestats\", \"12345 7891011\")\n```\n\nFritzConnection provides two basic commands to communicate with the router APIs: `call_action()` for the __TR-064-Interface__ and `call_http()` for the __(AHA)-HTTP-Interface__. Both APIs can be used on the same FritzConnection instance side by side.\n\n### call_action\n\n`call_action()` expects a __TR-064__ service- and an action-name (and optional arguments). In general FritzConnection can execute every service and action provided by the (model-specific) API as documented by AVM. For i.e. this can be network settings, status informations, access to home automation devices and much more. The `call_action()` method returns the response from the router as a dictionary with the values already converted to the matching Python datatypes.\n\n### call_http\n\n`call_http()` expects a command for the __http-interface__ like \"getbasicdevicestats\" and, depending on the command, additional arguments like a device \"ain\" (identifier). A call to the method returns a dictionary with the `content-type`, the `encoding` and the `response` data of the http-response. The content-type of the response-data is typical \"text/plain\" or \"text/xml\" and may need further processing.\n\n### Username and password\n\nTo avoid hardcoding the arguments `user` and `password` in applications FritzConnection can read both from the environment variables `FRITZ_USERNAME` and `FRITZ_PASSWORD`.\n\n\n### Caching\n\nOn instanciation FritzConnection has to inspect the model-specific router-API. This causes a lot of network requests and can take some seconds. To avoid this FritzConnection provides a cache that can get activated by the `use_cache` parameter:\n\n```\n    fc = FritzConnection(..., use_cache=True)\n```\n\nThis argument defaults to `False`. After creating the cache FritzConnection will start up much more faster.\n\n\n## Library\n\n\nThe package comes with library-modules to make some API calls easier and also demonstrates how to implement applications on top of FritzConnection.\n\n\n## Documentation\n\nThe full documentation and release notes are at [https://fritzconnection.readthedocs.org](https://fritzconnection.readthedocs.org)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Communicate with the AVM FRITZ!Box",
    "version": "1.13.2",
    "project_urls": {
        "Homepage": "https://github.com/kbr/fritzconnection"
    },
    "split_keywords": [
        "avm",
        "fritz!box",
        "fritzbox",
        "fritz"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f85ddeed6ea7599c9811af3afd2febcdbacf7f4365c4a81a72b14d111cc59507",
                "md5": "cd6277d252b90aa87d66dbc0c4c296da",
                "sha256": "74648f90411446c478370feb94e42ebe989a18cc6a1e61068756c4ff0253b572"
            },
            "downloads": -1,
            "filename": "fritzconnection-1.13.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd6277d252b90aa87d66dbc0c4c296da",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">= 3.7",
            "size": 68087,
            "upload_time": "2023-09-17T13:12:09",
            "upload_time_iso_8601": "2023-09-17T13:12:09.877880Z",
            "url": "https://files.pythonhosted.org/packages/f8/5d/deed6ea7599c9811af3afd2febcdbacf7f4365c4a81a72b14d111cc59507/fritzconnection-1.13.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cc55d3b75c1c43b69cd7a2c39b47b911a3fe0e65e67f6c1685947169a287253e",
                "md5": "ad023470b39fec45d4959c527e7109a3",
                "sha256": "ccc7ff207bb599394dfc19da29c8c54679e318d2b9304f3263a52cb9f4ed33c2"
            },
            "downloads": -1,
            "filename": "fritzconnection-1.13.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ad023470b39fec45d4959c527e7109a3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">= 3.7",
            "size": 54328,
            "upload_time": "2023-09-17T13:12:12",
            "upload_time_iso_8601": "2023-09-17T13:12:12.490935Z",
            "url": "https://files.pythonhosted.org/packages/cc/55/d3b75c1c43b69cd7a2c39b47b911a3fe0e65e67f6c1685947169a287253e/fritzconnection-1.13.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-17 13:12:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kbr",
    "github_project": "fritzconnection",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "fritzconnection"
}
        
Elapsed time: 0.11294s