fritzconnection


Namefritzconnection JSON
Version 1.14.0 PyPI version JSON
download
home_pagehttps://github.com/kbr/fritzconnection
SummaryCommunicate with the AVM FRITZ!Box
upload_time2024-08-12 16:03:14
maintainerNone
docs_urlNone
authorKlaus Bremer
requires_python>=3.7
licenseMIT
keywords avm fritz!box fritzbox fritz tr-064 aha-http homeautomation
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 instantiation 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": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "AVM FRITZ!Box fritzbox fritz TR-064 AHA-HTTP homeautomation",
    "author": "Klaus Bremer",
    "author_email": "bremer@bremer-media.com",
    "download_url": "https://files.pythonhosted.org/packages/2b/d3/ab3940b245f0555882a4cc3b85005ad3b6444a13fb88dcf076311835da9e/fritzconnection-1.14.0.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 instantiation 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.14.0",
    "project_urls": {
        "Homepage": "https://github.com/kbr/fritzconnection"
    },
    "split_keywords": [
        "avm",
        "fritz!box",
        "fritzbox",
        "fritz",
        "tr-064",
        "aha-http",
        "homeautomation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86b9a5895d2708dd70185a5db6b469af9af792d8680d6e2c88739d5a4322eb2b",
                "md5": "6d4adc6d4ad0faf1f103b1a4ff725c77",
                "sha256": "f0cbc1977f21a04630773244eb1ca985af15c345aef4bbd5757b8fb124e7de1d"
            },
            "downloads": -1,
            "filename": "fritzconnection-1.14.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6d4adc6d4ad0faf1f103b1a4ff725c77",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 71163,
            "upload_time": "2024-08-12T16:03:12",
            "upload_time_iso_8601": "2024-08-12T16:03:12.684344Z",
            "url": "https://files.pythonhosted.org/packages/86/b9/a5895d2708dd70185a5db6b469af9af792d8680d6e2c88739d5a4322eb2b/fritzconnection-1.14.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2bd3ab3940b245f0555882a4cc3b85005ad3b6444a13fb88dcf076311835da9e",
                "md5": "19f57a24af063ad913957656ce11bae7",
                "sha256": "95dacaf9bed6b52d809169006c0994bc55cc893dbe0a014bcf9535ae9d00982f"
            },
            "downloads": -1,
            "filename": "fritzconnection-1.14.0.tar.gz",
            "has_sig": false,
            "md5_digest": "19f57a24af063ad913957656ce11bae7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 57153,
            "upload_time": "2024-08-12T16:03:14",
            "upload_time_iso_8601": "2024-08-12T16:03:14.512314Z",
            "url": "https://files.pythonhosted.org/packages/2b/d3/ab3940b245f0555882a4cc3b85005ad3b6444a13fb88dcf076311835da9e/fritzconnection-1.14.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-12 16:03:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kbr",
    "github_project": "fritzconnection",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "lcname": "fritzconnection"
}
        
Elapsed time: 0.34365s